2

How can I disable the WS/WSS protocol in order to test the backward compatibility with old browser? I'm using socket.io library and I want to be sure the polling technique they have implemented meets my requirements.

2 Answers 2

3

The following is a hack rather than an answer:

Try overriding WebSocket so that it fails. i.e., before creating the socket.io client, try running the following script:

 WebSocket = undefined;

If all goes well, the socket.io client will receive your global variable (==undefined) instead of the standard Javascript Prototype, emulating a browser with no WebSocket support.

To undo this, refresh the page OR open the Javascript console and run:

 delete WebSocket

(the hack works on my Safari with the Plezi client... didn't check it with socket.io or other browsers)

Good Luck!

1

For your testing purposes, in your socket.io connect code, you can specify the allowable transports. So, to see how the polling option works for testing, you could specify that as the only option.

You could also run your web page in IE9 or a later version of IE in IE9 emulation mode (because IE9 does not support webSockets). I have tried this using IE11 and it does force socket.io into polling mode.

Not the answer you're looking for? Browse other questions tagged or ask your own question.