Native and emscripten websockets

167 views
Skip to first unread message

Pinguin Pinguin

unread,
May 9, 2022, 7:41:21 AM5/9/22
to emscripten-discuss
Hi 

we are searching for a C++ lib that provides WebSocket functionality for native and emscripten. We want to have one code base for the native Win/Mac/Linux/Android/iOS and the web version of our game.

We found native libs like websocketpp or boost beast but it looks like none of them has emscripten support. 

Any hints or tips?

Thanks a lot 
Kolja 

Mark Sibly

unread,
May 13, 2022, 10:51:51 PM5/13/22
to emscripten-discuss
Hi,

If you find one please tell me! I had to do this myself recently and ended up having to write my own websocket wrapper that uses the 'ixwebsocket' library for native builds and some custom JS for emscripten. Be happy to share the code although it's got a far bit of custom stuff in there so it's probably not much use 'as is'.

Bye,
Mark

Pinguin Pinguin

unread,
May 16, 2022, 1:21:45 AM5/16/22
to emscripten-discuss
Hi

I have not found any lib jet. And it looks like a not solved problem to me.
We look into boost::asio at the moment and hope that "Emulated POSIX TCP Sockets over WebSockets" works for us.

Kolja

James Ritts

unread,
May 16, 2022, 1:51:37 AM5/16/22
to emscripte...@googlegroups.com
I had a similar need and ended up writing my own socket wrapper to support websockets and tls encryption in emscripten and native.  I adapted the base socket API code from the mbedtls library, added SSL support from that same library, then wrote the websocket protocol handling, which is fortunately a pretty small and easy to implement spec.


--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/9753ca9a-c249-4894-9460-de25a201a3e3n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages