Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WebSockets #17

Open
tkrotoff opened this issue Oct 8, 2020 · 1 comment
Open

Support WebSockets #17

tkrotoff opened this issue Oct 8, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@tkrotoff
Copy link
Collaborator

tkrotoff commented Oct 8, 2020

Should we use https://github.com/sockjs/sockjs-node or the HTML5 API https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API ?

@tkrotoff tkrotoff added the enhancement New feature or request label Oct 8, 2020
@tkrotoff
Copy link
Collaborator Author

tkrotoff commented Nov 4, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant