You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi @davidbrochart thxs for the client demo correction but the new example with
from websockets import connect
from pycrdt import Doc, Map
from pycrdt_websocket import WebsocketProvider
async def client():
ydoc = Doc()
ymap = ydoc.get("map", type=Map)
async with (
connect("ws://localhost:1234/my-roomname") as websocket,
WebsocketProvider(ydoc, websocket),
):
# Changes to remote ydoc are applied to local ydoc.
# Changes to local ydoc are sent over the WebSocket and
# broadcast to all clients.
ymap["key"] = "value"
await asyncio.Future() # run forever
asyncio.run(client())
``
give me an error :
```(.venv) smag@smag-IdeaPad:~/dev/ypu/python$ python client.py
Traceback (most recent call last):
File "/home/smag/dev/ypu/python/client.py", line 18, in client
await asyncio.Future() # run forever
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f787b2808e0
During handling of the above exception, another exception occurred:
+ Exception Group Traceback (most recent call last):
| File "/home/smag/dev/ypu/python/client.py", line 20, in <module>
| asyncio.run(client())
| File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
| return loop.run_until_complete(main)
| File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
| return future.result()
| File "/home/smag/dev/ypu/python/client.py", line 9, in client
| async with (
| File "/home/smag/dev/ypu/python/.venv/lib/python3.10/site-packages/pycrdt_websocket/websocket_provider.py", line 133, in __aexit__
| return await self._exit_stack.__aexit__(exc_type, exc_value, exc_tb)
| File "/usr/lib/python3.10/contextlib.py", line 714, in __aexit__
| raise exc_details[1]
| File "/usr/lib/python3.10/contextlib.py", line 697, in __aexit__
| cb_suppress = await cb(*exc_details)
| File "/home/smag/dev/ypu/python/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 815, in __aexit__
| raise BaseExceptionGroup(
| exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/smag/dev/ypu/python/.venv/lib/python3.10/site-packages/pycrdt_websocket/websocket_provider.py", line 89, in _run
| self._websocket.path,
| AttributeError: 'ClientConnection' object has no attribute 'path'
here is the websocket.__dict__
hi @davidbrochart thxs for the client demo correction but the new example with
{'protocol': <websockets.client.ClientProtocol object at 0x7fae606d5360>, 'ping_interval': 20, 'ping_timeout': 20, 'close_timeout': 10, 'max_queue': (16, None), 'write_limit': (32768, None), 'id': UUID('a04adc92-2f7a-4b9f-8dd4-8da8c2c53992'), 'logger': <LoggerAdapter websockets.client (WARNING)>, 'debug': False, 'request': Request(path='/my-roomname', headers=Headers([('Host', 'localhost:1234'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', '5qvssS4Lqxsdt7pXgdxDGA=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('User-Agent', 'Python/3.10 websockets/14.1')]), _exception=None), 'response': Response(status_code=101, reason_phrase='Switching Protocols', headers=Headers([('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Accept', 'gt4Pwk9qBnZoW7ogg5m7uAWEsGY=')]), body=None, _exception=None), 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'close_deadline': None, 'fragmented_send_waiter': None, 'pong_waiters': {}, 'latency': 0, 'keepalive_task': <Task pending name='Task-2' coro=<Connection.keepalive() running at /home/smag/dev/ypu/python/.venv/lib/python3.10/site-packages/websockets/asyncio/connection.py:797> wait_for=>, 'recv_exc': None, 'connection_lost_waiter': , 'paused': False, 'drain_waiters': deque([]), 'response_rcvd': , 'recv_messages': <websockets.asyncio.messages.Assembler object at 0x7fae606d6140>, 'transport': <_SelectorSocketTransport fd=6 read=polling write=<idle, bufsize=0>>}
``
``
The text was updated successfully, but these errors were encountered: