You can try this library: https://github.com/wcauchois/websocket-fallback
It uses the Worlize / WebSocket-Node for browsers that implement newer versions of the protocol, and miksago / node -websocket-server for older browsers (Safari, I look at you!)
You just use one API and transparently deal with different browsers / connections / libraries for you.
source share