Skip to main content

WebSocket

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)​

IsClosed​

Added before v1.9 webSocket.IsClosed

Indicates that the web socket has been closed.

使用方式

WebSocket.IsClosed

傳回值


Url​

Added before v1.9 webSocket.Url

Contains the URL of the WebSocket.

使用方式

WebSocket.Url

傳回值


事件 (Events)​

event Close​

Added before v1.9 webSocket.event Close

Fired when the websocket closes.

使用方式

WebSocket.Close += async (_, webSocket) => {};

事件資料


event FrameReceived​

Added in: v1.9 webSocket.event FrameReceived

Fired when the websocket receives a frame.

使用方式

WebSocket.FrameReceived += async (_, webSocketFrame) => {};

事件資料


event FrameSent​

Added in: v1.9 webSocket.event FrameSent

Fired when the websocket sends a frame.

使用方式

WebSocket.FrameSent += async (_, webSocketFrame) => {};

事件資料


event SocketError​

Added in: v1.9 webSocket.event SocketError

Fired when the websocket has an error.

使用方式

WebSocket.SocketError += async (_, value) => {};

事件資料