joewalnes / reconnecting-websocket

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

Fix bug to allow binaryType to be set after creation #64

Open joshblum opened 8 years ago

joshblum commented 8 years ago

If you try to create a websocket and then set the binaryType, the library currently does not set it on the ws variable in the internal state. Something this will now work:

var socket = new ReconnectingWebSocket(url);
socket.binaryType = "arraybuffer";

Ref: http://stackoverflow.com/questions/16800979/can-a-websocket-switch-its-binarytype-on-the-fly