Skip to content

Commit

Permalink
emit 'close' when connect is not successfull
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Dec 5, 2018
1 parent cfec2cd commit 7c16e4a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion colyseus/connection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function connection:open(endpoint)
self.ws:on_connected(function(ok, err)
self.state = self.ws.state
if err then
self:emit('error', err)
self:emit("error", err)
self:emit("close", e)
self:close()

else
Expand Down Expand Up @@ -97,6 +98,7 @@ function connection:open(endpoint)
end

function connection:close()
self.state = "CLOSED"
self.ws:close()
self.ws = nil
end
Expand Down

0 comments on commit 7c16e4a

Please sign in to comment.