Skip to content

Commit

Permalink
Fix #75 - raw websockets never emitted close event
Browse files Browse the repository at this point in the history
  • Loading branch information
majek committed Oct 5, 2012
1 parent 8f0f9e3 commit f29fb5b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/trans-websocket.coffee
Expand Up @@ -140,11 +140,16 @@ class RawWebsocketSessionReceiver extends transport.Session
return true

didClose: ->
if @ws
if not @ws
return
@ws.removeEventListener('message', @_message_cb)
@ws.removeEventListener('close', @_end_cb)
try
@ws.close()
catch x
@ws = null

@readyState = Transport.CLOSED
@connection.emit('end')
@connection.emit('close')
@connection = null

0 comments on commit f29fb5b

Please sign in to comment.