Websocket client library that works on both desktop & wasm32?

Is there a websocket CLIENT (no need for server support) that works both when compiled on desktop/x86 and Chrome/wasm32 ?

Context: building software that runs on desktop & in chrome; wondering if I need to wrap websockets myself, or if this is already provided.


I have been using ws-tool in one of my desktop apps. It was the smallest implementation I could find that also supported synchronous client requests. I haven't tried it on wasm32, but I don't see any reason it wouldn't work.

tungstenite should also work.

edit: I also completely flubbed and forgot to consider the WebSocket implementation that already exists in browsers. (To be fair, WASM is not limited to browser environments, so the above suggestions are still relevant. Sort of.) The only library I am aware of that specifically targets both desktop and web environments is ewbsock.

1 Like

Sorry, should have been clear, for wasm32, the focus is "browser + use Chrome api", not "websocket via node/tcp connections"

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.