This is a really simple example on how to use websockets in OB2.
BLOCK:WsConnect
url = "wss://demo.piesocket.com/v3/channel_1?api_key=oCdCMcMPQpbvNjUIzqtvF1d2X2okWpDQj4AwARJuAgtjhzKxVEjQU6IdCjwm¬ify_self"
ENDBLOCK
BLOCK:WsSend
message = "hello"
ENDBLOCK
BLOCK:Delay
milliseconds = 1000
ENDBLOCK
BLOCK:WsRead
=> VAR @wsReadOutput
ENDBLOCK
BLOCK:WsDisconnect
ENDBLOCK
Note that this is just for testing. In most real-world scenarios you will need to first send an HTTP request to the HTTP webserver and then upgrade your connection to websocket.
You can read more about this here Protocol upgrade mechanism - HTTP | MDN
Ruri