socketio / socket.io

Realtime application framework (Node.JS server)
https://socket.io
MIT License
60.8k stars 10.09k forks source link

make interface match browser WebSocket class? #5080

Open jkarneges opened 8 years ago

jkarneges commented 8 years ago

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.

jkarneges commented 8 years ago

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?

jkarneges commented 8 years ago

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