WebSocket request-response subprotocol

后端 未结 7 573
走了就别回头了
走了就别回头了 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:17

    I would use JSON-RPC 2.0.

    http://www.jsonrpc.org/specification

    Each message would be a JSON object. The protocol states if it is a call that wants a response (coupling with id), or a notification.

    A JSON-RPC aware application could easily check if the message object contains a method, signifying a call, or not, signifying a response.

    I'm about to build a javascript lib to handle json rpc over websocket, with ajax as fallback…

提交回复
热议问题