开发者

Is there a good library in Node for asynchronous communication between the client and server?

开发者 https://www.devze.com 2023-03-01 13:20 出处:网络
Instead of creating every websocket and defining the entire structure by hand, is there a library that will let me run a function on the Node.js server, that can call a related function on all clients

Instead of creating every websocket and defining the entire structure by hand, is there a library that will let me run a function on the Node.js server, that can call a related function on all clients connected to the server simultaneously? Likewise, can I securely call a server function FROM the client browser? I feel like every time I have to construct a command to send over the web socket, I'm working on the transmission layer instead of the application layer, and I want to be thinking a开发者_开发技巧t the higher layer the entire time.

I wouldn't mind building something like this myself if it doesn't already exist, but I have a hard time believing this isn't solved on node already.


What you are really looking for is an node.js RPC solution. Here are a couple of node.js RPC options:

  • DNode - shows some good examples.
  • BERT-RPC
  • nowjs

I have not personally used them, but they look like they have good potential.


Try to look at now.js.


Try msg-rpc, it just provides the rpc support you need, also no particular requirement for the websocket library of server/client you already have. Tell how to send out a message and forward the messages received, that's all.

0

精彩评论

暂无评论...
验证码 换一张
取 消