joewalnes / reconnecting-websocket

A small decorator for the JavaScript WebSocket API that automatically reconnects
MIT License
4.21k stars 968 forks source link

fixed a bug #55

Open YongX opened 9 years ago

YongX commented 9 years ago

The local variable timeout will make clearTimeout(timeout) fail, since it's value will be undefined.

When the server close the socket, the clearTimeout(timeout) which in the ws.onclose callback function will not work correctly, and this suppose to be a bug I think.