Outbound Websocket
The Outbound Webscoket component makes it possible to configure a Gen2+ Shelly device to establish and maintain an outbound websocket connection. An RPC channel is available over said connection, supporting all features of inbound WS and MQTT channels, along with unsolicited complete status notifications on connect. The Outbound Websocket component uses ws
as RPC namespace and provides the methods:
Ws.SetConfig
to update the component's configurationWs.GetConfig
to obtain the component's configurationWs.GetStatus
to obtain the component's status
It uses the key ws
when enumerated in objects including multiple component payloads, like Shelly.GetStatus
.
Methods
Ws.SetConfig
Property | Type | Description |
---|---|---|
| object | Configuration that the method takes |
Find more about the config properties in config section
Ws.GetConfig
Find the Ws.GetConfig response properties in config section
Ws.GetStatus
Find the Ws.GetStatus response properties in status section
Configuration
Property | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
| boolean |
| ||||||||
| string | Name of the server to which the device is connected. When prefixed with wss:// a TLS socket will be used | ||||||||
| string | Type of the TCP sockets
|
Status
Property | Type | Description |
---|---|---|
| boolean |
|
Examples
Ws.SetConfig example
- Ws.SetConfig HTTP GET Request
- Ws.SetConfig Curl Request
- Ws.SetConfig Mos Request
http://192.168.33.1/rpc/Ws.SetConfig?config={"ssl_ca":"*"}
curl -X POST -d '{"id":1,"method":"Ws.SetConfig","params":{"config":{"ssl_ca":"*"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Ws.SetConfig '{"config":{"ssl_ca":"*"}}'
Response
- Ws.SetConfig HTTP GET Response
- Ws.SetConfig Curl Response
- Ws.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
Ws.GetConfig example
- Ws.GetConfig HTTP GET Request
- Ws.GetConfig Curl Request
- Ws.GetConfig Mos Request
http://192.168.33.1/rpc/Ws.GetConfig
curl -X POST -d '{"id":1,"method":"Ws.GetConfig"}' http://${SHELLY}/rpc
mos --port ${PORT} call Ws.GetConfig
Response
- Ws.GetConfig HTTP GET Response
- Ws.GetConfig Curl Response
- Ws.GetConfig Mos Response
{
"enable": false,
"server": null,
"ssl_ca": "*"
}
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"params": {
"enable": false,
"server": null,
"ssl_ca": "*"
}
}
{
"enable": false,
"server": null,
"ssl_ca": "*"
}
Ws.GetStatus example
- Ws.GetStatus HTTP GET Request
- Ws.GetStatus Curl Request
- Ws.GetStatus Mos Request
http://192.168.33.1/rpc/Ws.GetStatus
curl -X POST -d '{"id":1,"method":"Ws.GetStatus"}' http://${SHELLY}/rpc
mos --port ${PORT} call Ws.GetStatus
Response
- Ws.GetStatus HTTP GET Response
- Ws.GetStatus Curl Response
- Ws.GetStatus Mos Response
{
"connected": false
}
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"params": {
"connected": false
}
}
{
"connected": false
}