File: class-websocket.md | Updated: 11/18/2025
On this page
The WebSocket class represents WebSocket connections within a page. It provides the ability to inspect and manipulate the data being transmitted and received.
If you want to intercept or modify WebSocket frames, consider using WebSocketRoute .
Methods
Added before v1.9 webSocket.IsClosed
Indicates that the web socket has been closed.
Usage
WebSocket.IsClosed
Returns
Added before v1.9 webSocket.Url
Contains the URL of the WebSocket.
Usage
WebSocket.Url
Returns
Events
Added before v1.9 webSocket.event Close
Fired when the websocket closes.
Usage
WebSocket.Close += async (_, webSocket) => {};
Event data
Added in: v1.9 webSocket.event FrameReceived
Fired when the websocket receives a frame.
Usage
WebSocket.FrameReceived += async (_, webSocketFrame) => {};
Event data
Added in: v1.9 webSocket.event FrameSent
Fired when the websocket sends a frame.
Usage
WebSocket.FrameSent += async (_, webSocketFrame) => {};
Event data
Added in: v1.9 webSocket.event SocketError
Fired when the websocket has an error.
Usage
WebSocket.SocketError += async (_, value) => {};
Event data