-
Is there a way to hook into the emscripten API before a websocket connection is made? At the stage where it has created the URL and before calling the Javascript API to attempt the websocket connection? Or an option to force all connections via websockets to use WSS instead of WS (ie over https instead of http) I've just been editing the javascript output manually where it checks the url and changing the prefix to wss:// This is for an app written in C/C++ using sockets (ENet) for a simple chat server/client (see the tutorial for Enet) . Both compile cleanly via emscripten. Client works in browsers and server via Node.js They connect nicely over http and works as intended without any changes to the enet library code. The problems begin when hosting it on a https website. The C/C++ code that works with raw sockets have no idea about SSL and should not need it. Browsers can use https and the node server can be put behind a reverse proxy to terminate the https connection to it. Browsers will not allow unsecured connections from a https page. I need a way to force it to always use wss when opening a websocket connection via the browser. Ideally I would also like a way to get a hold of any websocket emscripten creates, look at the http request headers it handles. In my use case I cant use functions like emscripten_websocket_set_onopen_callback() because I am not opening the raw sockets myself, it done via the Enet library. Just a few pages of the source that seemed relevant. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Isn't this what the Lines 367 to 373 in 055c6e8 |
Beta Was this translation helpful? Give feedback.
Isn't this what the
WEBSOCKET_URL
setting is for?emscripten/src/settings.js
Lines 367 to 373 in 055c6e8