Websocket agent subscription JSON

im having trouble with the JSON object that connects subscriptions in Websocket agent. This is what i tried with no luck:


Any help is appreciated!

A websocket subscription is a JSON object; there are two types websocket and http as can be explored in the code base here.

If you just need to send a payload to the websocket server on connect then the websocket type will do something like:

  { "type": "websocket", "body": "/ws/uplink/CABACABA" }

Hi Rich,
my idea is to receive a payload from the websocket server to an attribute linked with the agent. Is enough setting up the subscription to start getting the messages? Thanks!

The subscriptions are only there for websocket servers that require it. Quite often with websocket servers simply connecting is not enough, you often need to send messages to subscribe to data of interest.

If you are in control of the websocket server then how it works is also up to you; simply establishing a connection could be enough for the server to start sending data to the agent.

Once the websocket server is sending data back then you can use that data to update attribute(s).