WebSocket request-response subprotocol

后端 未结 7 522
走了就别回头了
走了就别回头了 2020-12-22 23:47

WebSocket provides a bi-directional communication like a human being talks. The client can send data to the server and the server can send data to the client anytime. But wh

相关标签:
7条回答
  • 2020-12-23 00:19

    A bit late on this discussion but, BrokerJS is a reactive alternative you can try in NodeJS. Define a data model and subscribe websocket connections to specific keys of the model. Any changes to server side variable are automatically reflected on the client side. I think this will save you a lot of boilerplate code. Even better, you can still use the old-fashioned websocket messaging parallel to the new reactive way of doing things. It is far from a polished product and arrays are a headache. But in conjunction with something like VueJS, React or Svelte, I think it will save you a lot of trouble.

    Disclaimer: I am the the author of BrokerJS.

    0 讨论(0)
提交回复
热议问题