From 600d0729bb5d544d6aa8b2b246d9c9413f58bfb6 Mon Sep 17 00:00:00 2001 From: Alexander Emelin Date: Wed, 13 Mar 2024 23:12:56 +0200 Subject: [PATCH] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6569e08..3b35cfa 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ When using Protobuf protocol: Event callbacks are called by SDK using `await` internally, the websocket connection read loop is blocked for the time SDK waits for the callback to be executed. This means that if you need to perform long operations in callbacks consider moving the work to a separate coroutine/task to return fast and continue reading data from the websocket. +The fact WebSocket read is blocked for the time we execute callbacks means that you can not call awaitable SDK APIs from callback – because SDK does not have a chance to read the reply. You will get `OperationTimeoutError` exception. The rule is the same - do the work asynchronously, for example use `asyncio.ensure_future`. + ## Run example To run [example](https://github.com/centrifugal/centrifuge-python/blob/master/example.py), first start Centrifugo with config like this: