A client to send and receive data to a WebSocket.
+ How To Add This Control To Your Project (Click to Expand)
- Make sure you have the latest version of ARC installed.
- Select the Get button in this page to download the archive file.
- Double click the downloaded archive file to execute installer.
- The installer will add this control to ARC.
- Load ARC and press the Project -> Add Control button from the menu.
- Choose the Communication category tab.
- Press the Websocket Client icon to add the control to your project.
A client to send and receive data to a WebSocket, assign the response to a variable, and execute scripts.
Use ControlCommand to open a connection to a remote host and send data. The received data will be assigned to a variable and the specified script will execute. Once a connection is established to the server using the ControlCommand Open, your program may now send messages to the server via the ControlCommand Send. Any messages received from the server are stored in a variable and the script is launched.
1) The Response Variable will hold the text response message that is sent from the server.
2) Response Script will be executed for every response that is sent from the server. Within this script, the response message is available in the Response Variable. By default, an example script will speak the response data.
3) The Connection Status Variable holds a true or false bool regarding the status of the connection to the server.
4) Enable Debug will display the full response message in the log window. This will consume unnecessary CPU and memory in a production environment and is only for debugging. By default, this is checked.
This example command will create a connection to the public WebSocket echo server for testing. Any data sent to this web socket server will be echoed back.
ControlCommand("WebSocket Client", "Open", "ws://echo.websocket.org");
Send test data once the connection has been established. You can continually send data as needed. When data is received from the server, the response will be assigned to a variable and the script will execute. By default, the script will speak the response.
ControlCommand("WebSocket Client", "Send", "Text to send");