Version: 1.11.0

WebSocket

The WebSocket class represents websocket connections in the page.

WebSocket.onClose(handler)#

Fired when the websocket closes.

WebSocket.onFrameReceived(handler)#

Fired when the websocket receives a frame.

WebSocket.onFrameSent(handler)#

Fired when the websocket sends a frame.

WebSocket.onSocketError(handler)#

Fired when the websocket has an error.

WebSocket.isClosed()#

Indicates that the web socket has been closed.

WebSocket.url()#

Contains the URL of the WebSocket.

WebSocket.waitForFrameReceived([options], callback)#

Performs action and waits for a frame to be sent. If predicate is provided, it passes WebSocketFrame value into the predicate function and waits for predicate(webSocketFrame) to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is received.

WebSocket.waitForFrameSent([options], callback)#

Performs action and waits for a frame to be sent. If predicate is provided, it passes WebSocketFrame value into the predicate function and waits for predicate(webSocketFrame) to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is sent.