WebSocket Publish

Publish data to WebSocket server in JSON format

  • Library:
  • Simulink Support Package for Raspberry Pi Hardware / Network

Description

The WebSocket Publish block publishes the data from the Raspberry Pi™ to a WebSocket server identified by an IP address and a port. The published data is in JavaScript Object Notation (JSON) format, which can be interpreted by a WebSocket client to visualize the data.

If the WebSocket server is hosted on a network IP address, any device on the network can connect to the sever and access the data.

Websocket JSON data

This figure shows the signals in JSON format with a unique block label.

Ports

Input

expand all

The signal data to be published to the WebSocket server, specified as a row vector.

The block provides an option to add up to 10 Signal input ports that you can use to obtain signal data, with each signal being a row vector.

Example: [1.5,3]

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean

Parameters

expand all

Specify a unique label for the block to identify the published JSON data (which gets created from the input signal data). The label can have a maximum of 128 characters.

IP address of the WebSocket server on which the JSON data is hosted.

Port number on the WebSocket server on which the JSON data is hosted.

Note

You can use multiple Websocket Publish blocks in a Simulink model if the Server IP address and Server Port parameters are unique.

Total number of input signal connections to the block, which is then converted to JSON format.

Introduced in R2019b