You are here: Reference Manual > FME Server Services > Notification Service > Subscribers > WebSocket Server Messaging Protocol

WebSocket Server Messaging Protocol

The WebSocket server must open messages before sending them. To open messages, the following schema is used:

Note: JSON is used for all messaging

{

ws_op : 'open',

ws_stream_id : <streamid>,

}

Once a message is opened, a connection is established, using the Stream ID to identify the message. The WebSocket server then relays messages using this schema:

{

ws_op : 'send',

ws_msg : <msg>

}

The WebSocket server supports sending multiple messages after a stream is opened.

After sending messages, it is a good practice to request that the WebSocket server close the message stream. However, if a message is not explicitly closed, the WebSocket server closes it automatically.

{

ws_op: 'close'

}

Keywords:

  • ws_op: Defines the WebSocket operation. If you want the WebSocket server to open messages, specify 'open'. To send messages, specify 'send'. To close a message stream, specify 'close'.
  • ws_stream_id: Identifies the message stream so that the WebSocket server can associate it with the correct requesting application, such as the FME Notification Service or a WebSocket web server.