Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding a piece to the disconnect

  • Loading branch information...
commit 5486bbffce54649966d5bdb277b09bcb21b052ae 1 parent 14ebe0a
@jeregrine authored
Showing with 5 additions and 6 deletions.
  1. +1 −2  public/client.coffee
  2. +2 −2 public/client.js
  3. +2 −2 server.coffee
View
3  public/client.coffee
@@ -97,6 +97,5 @@ $(document).ready ->
msg = $("#newMessage").val("")
$(window).unload ->
- window.socket.emit("disconnect")
window.socket.disconnect()
-
+ window.socket.emit("disconnect")
View
4 public/client.js
@@ -121,6 +121,6 @@
});
$(window).unload(function() {
- window.socket.emit("disconnect");
- return window.socket.disconnect();
+ window.socket.disconnect();
+ return window.socket.emit("disconnect");
});
View
4 server.coffee
@@ -65,8 +65,8 @@ io.sockets.on 'connection', (socket) ->
msg.save()
socket.on 'disconnect', ()->
- if (this.connection.readyState != 'closed')
- this.connection.close()
+ if (socket.connection.readyState != 'closed')
+ socket.connection.close()
socket.get "user", (err, user)->
releaseColor(user.color)
io.sockets.emit "bye-user", user
Please sign in to comment.
Something went wrong with that request. Please try again.