WebSocket provider
WebSocket provider.
Source code in pycrdt_websocket/websocket_provider.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
started: Event
property
An async event that is set when the WebSocket provider has started.
__init__(ydoc, websocket, log=None)
Initialize the object.
The WebsocketProvider instance should preferably be used as an async context manager:
async with websocket_provider:
...
task = asyncio.create_task(websocket_provider.start())
await websocket_provider.started.wait()
...
websocket_provider.stop()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ydoc |
Doc
|
The YDoc to connect through the WebSocket. |
required |
websocket |
Websocket
|
The WebSocket through which to connect the YDoc. |
required |
log |
Logger | None
|
An optional logger. |
None
|
Source code in pycrdt_websocket/websocket_provider.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
start(*, task_status=TASK_STATUS_IGNORED)
async
Start the WebSocket provider.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_status |
TaskStatus[None]
|
The status to set when the task has started. |
TASK_STATUS_IGNORED
|
Source code in pycrdt_websocket/websocket_provider.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
stop()
Stop the WebSocket provider.
Source code in pycrdt_websocket/websocket_provider.py
133 134 135 136 137 138 139 |
|