Mongoose Websocket Server with JavaScript Websocket Client? #1685
-
Hi, I have an application where I would like to use a Mongoose websocket server, but it needs to communicate with an existing JavaScript websocket client. I see that the way in which Mongoose upgrades to websocket is based on having "/websocket" in the uri. So the example websocket server does not connect to the existing JavaScript websocket client. I'm sure I can get around this, but my question before investing time is; is the rest of the websocket server code compliant with the websocket standard, or will communicating with the JavaScript client have additional issues? Here is a simple version of the JavaScript websocket client. Many Thanks. Index.html
index.js
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
RFC6455 section 3 clearly allows URI paths. mongoose/examples/websocket-server/main.c Lines 18 to 32 in 7252f53
You might as well modify your JS client by adding |
Beta Was this translation helpful? Give feedback.
RFC6455 section 3 clearly allows URI paths.
Observe the example code, you control your URIs, you decide where to upgrade. The choice of using
/websocket
is just a convenience to be able to also serve HTML using a single port (and a single listener). How do you plan to serve that client to the browser ?If you don't want to serve HTML then just upgrade on any URI, just change
mongoose/examples/websocket-server/main.c
Lines 18 to 32 in 7252f53