Closed gavllew closed 11 years ago
Looks good otherwise (y)
I'm also curious to know if the error manifested itself as an uncaught exception or an unhandled 'error' event on the websocket-server object?
The error was an uncaught exception. Unfortunately I don't have the logs anymore, but the exception thrown from the websocket server was "Error('not opened')" - see https://github.com/einaros/ws/blob/master/lib/WebSocket.js#L174
@gavllew Thanks for the link to the error - it was an exception as you mentioned.
This is the commit I'm going to merged (squashed for easy reading). Let me know if it looks good to you. 2c5cfced126211ec46cd9785704f2c620c644128
Looks good to me, thanks!
Merged as a1ab095625678dd876986cba8c252612e817b0b6 Please could you submit another request to include magic constants 30000 and 60000 (possibly 30000 * 2??) as a config. variable. See https://github.com/dhruvbird/node-xmpp-bosh/blob/master/bosh.conf.example.js for an example. Units should be second. Name could be something like websocket_ping_interval.
Update: README.md would also need to be updated.
Thank you for submitting a patch. I appreciate it!
I will try to add the config soon.
I was seeing some server restarts on occasion when a websocket client closes a connection - the XMPP server would attempt to distribute the unavailable presence, and this would get passed to the closed websocket server, throwing an uncaught exception.
In attempting to fix this, I ended up reworking a lot of the stream/connection close code - it should now be compliant with section 3.5 of draft-moffitt-xmpp-over-websocket-03 (i.e. respond to a stream close with another stream close, and let the initiator send the websocket close frame).
It also now sends a websocket ping frame every thirty seconds for each connection, and checks for the 'pong' response. This is for the following reasons: