mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-29 00:25:58 +08:00
2.0 KiB
2.0 KiB
sidebar_position | description |
---|---|
4 | nonebot.drivers.websockets 模块 |
nonebot.drivers.websockets
websockets 驱动适配
nb driver install websockets
# 或者
pip install nonebot2[websockets]
:::tip 提示 本驱动仅支持客户端 WebSocket 连接 :::
def catch_closed(func)
-
参数
func
-
返回
- Unknown
class Mixin()
-
说明
Websockets Mixin
property type
- 类型: str
async method request(self, setup)
-
参数
setup
(nonebot.internal.driver.model.Request)
-
返回
- nonebot.internal.driver.model.Response
method websocket(self, setup)
-
参数
setup
(nonebot.internal.driver.model.Request)
-
返回
- AsyncGenerator[WebSocket, NoneType]
class WebSocket(*, request, websocket)
-
说明
Websockets WebSocket Wrapper
-
参数
-
request
(nonebot.internal.driver.model.Request) -
websocket
(websockets.legacy.client.WebSocketClientProtocol)
-
property closed
- 类型: bool
async method accept(self)
-
返回
- Unknown
async method close(self, code=1000, reason='')
-
参数
-
code
(int) -
reason
(str)
-
-
返回
- Unknown
async method receive(self)
-
返回
- str
async method receive_bytes(self)
-
返回
- bytes
async method send(self, data)
-
参数
data
(str)
-
返回
- None
async method send_bytes(self, data)
-
参数
data
(bytes)
-
返回
- None
class Driver(env, config)
property type
- 类型: str