You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data flow between REST APIs (unidirectional) and WebSockets (bidirectionnal) are very different:
With REST APIs the client fetches the data: always the same simple scenario + the protocol (get, update, delete) & format (JSON) is known in advance
With WebSockets the protocol/format is unknown and varies: the client can subscribe to topics and then it is the server that sends data to the client
Implementations:
I'm the client, GET... data. The stub server replies.
I'm the client, I don't ask anything, just send me relevant WebSockets messages if ? from a WebSockets server
OK: I'm the stub-server, please WebSockets server, send this message to the client. How? (protocol/format) and when?
(the client == the user == the browser)
Because of the nature of WebSockets (bidirectional and unknown protocol/format) I don't think it is possible to add support for WebSockets inside stub-server. WebSockets is lower-level compared to REST.
Should we use https://github.com/sockjs/sockjs-node or the HTML5 API https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API ?
The text was updated successfully, but these errors were encountered: