socket.io
socket.io copied to clipboard
make interface match browser WebSocket class?
The engine.io client is so close to a polyfill for the browser WebSocket class that I wonder if it shouldn't match the interface? E.g. setting callbacks with onmessage = func instead of on('message', func) and so on. This way, projects that use the WebSocket class could support the engine.io client via simple dependency injection, rather than having to be made specifically aware of engine.io.
Apparently it even used to work this way: http://www.devthought.com/2012/07/07/the-realtime-engine/
Would a patch to support the WebSocket interface be accepted?
We went ahead and made a wrapper to emulate the WebSocket class. Here it is if anyone's interested: https://github.com/fanout/engine.io-as-websocket