page.on('websocket') event.
Methods
url
Returns the URL of the WebSocket.string
isClosed
Returns whether the WebSocket has been closed.boolean
waitForEvent
Waits for a specific event to be emitted.string
required
Event name. Can be:
framesent- Emitted when a frame is sentframereceived- Emitted when a frame is receivedclose- Emitted when the WebSocket closessocketerror- Emitted when a socket error occurs
function
Optional predicate function to filter events.
number
Maximum time to wait in milliseconds. Defaults to 30000 (30 seconds).
Promise<any>
Events
framesent
Emitted when a WebSocket frame is sent from the page.payload: string | Buffer - The frame payload
framereceived
Emitted when a WebSocket frame is received by the page.payload: string | Buffer - The frame payload
