web.websocketConnect

Creates a WebSocket connection.

ExampleMiscellaneous Functions

Syntax

            
            web.websocketConnect( {object} );

JavaScript Object

{
    id: "<string>" ,
    uri: "<string>" ,
    origin: "<string>" ,
    secWebSocketKey: "<string>" ,
    secWebSocketProtocol: "<string>" ,
    secWebSocketExtensions: "<string>" ,
    onOpenCB: "<string>" ,
    onMessageCB: "<string>" ,
    onErrorCB: "<string>" ,
    onCloseCB: "<string>" ,
 }
Property Name
Description
idA unique number indicating the connection number. This value is generated automatically during code generation.
uriThe WebSocket endpoint in ws:// or wss:// (secure WebSocket schema) format.
originOrigin header value.
Optional: Only generated if detected during the recording session.
secWebSocketKeySec-WebSocket-Key header value.
Optional: The WebSocket key value. Not recorded, but can be added manually.
secWebSocketProtocolSec-WebSocket-Protocol header value.
Optional: Only generated if detected during the recording session.
secWebSocketextensionsSec-WebSocket-extensions header value.
Optional: Only generated if detected during the recording session.
onOpenCBCallback function name for an OnOpen event (optional). For details, see WebSocket Callback Functions.
onMessageCBCallback function name for an OnMessage event (optional). For details, see WebSocket Callback Functions.
onErrorCBCallback function name for an OnError event (optional). For details, see WebSocket Callback Functions.
onCloseCBCallback function name for an OnClose event (optional). For details, see WebSocket Callback Functions.

This function creates a WebSocket connection upon which to send the message.

Headers that were detected during recording will be generated automatically, except for SecWebSocketKey. To add additional headers to the handshake request, place web.addHeader or web.addCookie steps before this function.

Callbacks will be generated with the default implementation commented out. For a description of the callback functions, see WebSocket Callback Functions.

Return Values

Not applicable

Parameterization

Standard Parameterization is supported for all of this function's arguments.

Example

web.websocketConnect({
   id:0, 
   uri:"ws://pumpkin:9876/", 
   origin:"http://pumpkin:9876", 
   onOpenCB:OnOpenCB0, 
   onMessageCB:OnMessageCB0, 
   onErrorCB:OnErrorCB0,
   onCloseCB:OnCloseCB0
});