This document describes the WebSocket Tasks, provided as custom tasks that must be installed with PureLoad/PureTest on each installation using these tasks.
Before you use the tasks, read more about installing and how to load custom tasks .
The WebSocket tasks supports the WebSocket protocol as described in RFC 6455.
Client side tasks exist to initiate and handle handshake over an HTTP connection and to support sending and receiving WebSocket messages.
In addition 2 simple server tasks exist to start and stop a WebSocket server. This server is for functional test only.
The following lists the provided tasks. Please follow the links for more details.
This is an HTTP tasks that send an HTTP request and performs a handshake as described in RFC 6455. When a valid response is received and a valid WebSocket Connection is Established the other tasks may be used send an receive WebSocket messages.
To set proxy, or other HTTP settings, the standrad HttpInitTask might be used.
The received HTTP response is saved to allow validation and/or extract of information as with any other HTTP tasks.
Parameters exist to specify URL, WebSocket protocol to be used etc. Use the spot-help in PureTest/PureLoad for information about each parameter.
Task to send a WebSocket text message to server.
Parameter is used to specify the text message to be sent.
Task to send a WebSocket binary message to server.
Parameter is used to specify the binary message to be sent. The Binary data is must be hex-encoded using the format: \xNN, where NN is a hexadecimal number.
Task to send a WebSocket Ping control message (with opcode 0x9) to server.
Parameter is used to specify optional text body to be sent with the Ping message.
Task to send check or wait for WebSocket message received. If a timeout is specified the task will block until a message is received or a timeout has occured.
If a timeout is not specified, the task will just check if a messages has been received and set a variable (${websocket.msgstate}) to indicate if a message is received or not.
Task to close WebSocket connection to server. The task will send a close control frame, wait for close response and close the connection.
The received close message will be saved in text format, to allow validation and/or extract of information using any standard utility tasks.
Task to initiate a HTTP/WebSocket server. The task will accept connections for a hardcoded set of protocols. See Supported WebSocket Protocols for details.
HTTPS/SSL is also supported. Read more about HTTPS/SSL support
Parameters exist to specify host and port that the server will listen to. If port is set to 0, the system will pick a port and used port is assigned to variable (${websocket.server.port}).
Stop server and close connections used.