Concepts

WebSockets

WebSockets

WebSocket patches allow you to make connections to a WebSocket server and then send text or JSON to it and receive text or JSON from it.

This is broken up into several patches so that you can send and receive different types of messages.

WebSocket Connection

WebSocket Connection

  • Connect
  • URL
  • Headers
  • Connection
  • Connected
  • Error

The WebSocket Connection patch will connect to the provided URL with the given HTTP Headers when the Connect port is enabled. It will stay connected unless an error occurs or the Connect port is turned off. The Connection output should be connected to WebSocket Send and WebSocket Receive patches. The Connected output will indicate whether the connection is valid. The Error output will show the error, if one has occurred. This patch cannot be looped.

WebSocket Send

WebSocket Send

  • Connection
  • Send
  • Message

The WebSocket Send patch takes a Connection from a WebSocket Connection patch and will send the Message to it when the Send port is pulsed. The patch is type variant and currently supports text or JSON. The message can be a loop of values or a single value. You can have as many WebSocket Send patches as you want for each Connection.

WebSocket Receive

WebSocket Receive

  • Connection
  • Message

The WebSocket Receive patch takes a Connection from a WebSocket Connection patch and will receive Messages from it. The patch is type variant and currently supports text or JSON; only messages that match the type will be received by the patch. The output can be a loop of Messages if multiple are received on one frame. You can have as many WebSocket Receive patches as you want for each Connection and each will receive messages that match the type.