The WebSocket protocol is a TCP-based network protocol that allows to establish a full-duplex (bidirectional) connection between client and server. A conventional HTTP connection follows the request-response principle: each client request triggers a server response.
To establish a WebSocket connection, the client sends a WebSocket upgrade request embedded in an HTTP message. Once acknowledged by the server, the open connection can be used for communication by both the server and the client at any time.
Using the WebSocket protocol results in reduced network traffic and latency. It is an alternative to communication models such as polling and long-polling that were used to simulate full-duplex connections.
You can either create a test script by manually scripting the respective functions, or you can use the Silk Performer Recorder to do the scripting for you. To learn about the WebSocket BDL functions, refer to the BDL Reference.
There are two functions you can use to establish a connection to a WebSocket server: Scripting WebSocketConnect establishes an asynchronous communication channel. Scripting WebSocketConnectSync establishes a synchronous communication channel.
The WebSocket protocol provides for sending and receiving both text and binary messages. Accordingly, Silk Performer offers WebSocketSendTextMessage and WebSocketSendBinaryMessage to support these message types.