![]() |
NapPlana.NET 引用文档 0.3.4
Yet Another NapCat Framework SDK for .NET
|
DI架构下的WebSocket连接基类 通过依赖注入管理事件处理、API处理和事件解析 更多...
Public 成员函数 | |
| WebSocketDiConnection (string ip, int port, string? token, IEventHandler eventHandler, IApiHandler apiHandler, IEventParser eventParser) | |
| 通过依赖注入获取核心服务 | |
| override async Task | InitializeAsync () |
| 初始化连接 | |
| override async Task | ShutdownAsync () |
| 关闭连接 | |
| override async Task | SendMessageAsync (string message) |
| 发送原始消息,修改自WebsocketClientConnection | |
| override async Task | SendMessageAsync (ApiActionType actionType, object message, string echo) |
| 发送消息,修改自WebsocketClientConnection | |
Public 成员函数 继承自 NapPlana.Core.Connections.WebSocket.WebsocketClientConnection | |
| WebsocketClientConnection () | |
| 初始化 | |
| WebsocketClientConnection (string ip, int port, string? token=null) | |
| 带参初始化 | |
Public 成员函数 继承自 NapPlana.Core.Connections.ConnectionBase | |
| virtual async Task | ReceiveMessageAsync () |
| 发送消息时调用 | |
额外继承的成员函数 | |
Protected 属性 继承自 NapPlana.Core.Connections.ConnectionBase | |
| string | Ip = "" |
| int | Port |
| string? | Token |
属性 继承自 NapPlana.Core.Connections.ConnectionBase | |
| BotConnectionType | ConnectionType = BotConnectionType.None [get, set] |
| 连接类型 | |
属性 继承自 NapPlana.Core.Connections.IConnectionBase | |
DI架构下的WebSocket连接基类 通过依赖注入管理事件处理、API处理和事件解析
| NapPlana.DI.Connection.WebSocketDiConnection.WebSocketDiConnection | ( | string | ip, |
| int | port, | ||
| string? | token, | ||
| IEventHandler | eventHandler, | ||
| IApiHandler | apiHandler, | ||
| IEventParser | eventParser | ||
| ) |
通过依赖注入获取核心服务
| ip | NapCat服务器IP |
| port | NapCat服务器端口 |
| token | 访问令牌(可选) |
| eventHandler | 事件处理器 |
| apiHandler | API响应处理器 |
| eventParser | 事件解析器 |
|
virtual |
发送消息,修改自WebsocketClientConnection
| actionType | 操作 |
| message | 消息内容 |
| echo | 标识符 |
重载 NapPlana.Core.Connections.WebSocket.WebsocketClientConnection .
|
virtual |
发送原始消息,修改自WebsocketClientConnection
| message | 消息json |
重载 NapPlana.Core.Connections.WebSocket.WebsocketClientConnection .