You are here: FME Server Reference Manual > FME Server Services > Notification Service > WebSocket Publisher

WebSocket Publisher

The WebSocket publisher receives messages over TCP from a WebSocket-supported client and publishes them to FME Server topics. Supported clients can be Java and HTML5-based, and can include the following web browsers:

WebSocket Communication Channels

By default, FME Server uses the following channels for WebSocket communication:

Configuring the Publisher

  1. In the FME Server Web User Interface, select Notifications in the sidebar. Select the Publications tab and click New.
  2. Provide a name for the Publication
  3. In the Protocol drop down menu, select WebSocket.
  4. Target URL: This field is pre-populated with the URL of the WebSocket server on the local host system (included with your FME Server installation). However, you can choose to connect to a different WebSocket server.
  5. Stream ID: Specify the Stream ID for the publication. The Stream ID allows the WebSocket server to identify messages and connect them to requesting applications. In this case, the requesting application is the Notification Service Publisher.
  6. Specify the topics you want to publish to using the drop-down selector, or click Select All if you want to publish to all topics.
  7. Click OK.

Opening, Sending and Closing Messages

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:

For example, consider the following series of messages from an HTML5 client to your WebSocket Server:

{

ws_op : 'open',

ws_stream_id : 'send-stream',

}

{

ws_op : 'send',

ws_msg : 'Hello World'

}

{

ws_op: 'close'

}

After the WebSocket server opens the "send-stream" message stream, it is sent to any publishers created on that stream. The message "Hello World" is then delivered to all the topics defined for those publishers. The WebSocket server then closes the stream.

See Also

Safe Software Inc. www.safe.com