Commit 6ed2b13 1 parent 2ab9808 commit 6ed2b13 Copy full SHA for 6ed2b13
File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -137,10 +137,10 @@ def _init_apps(self) -> list[_T]:
137
137
138
138
return app_instances
139
139
140
- async def loop (self ) -> None :
141
- """Method is intended for calling in endless loop to process Rocket.Chat callbacks . """
140
+ async def message_handler (self , message : str ) -> None :
141
+ """Serializes message context and run processing for each app . """
142
142
143
- raw_context : WebSocketClientProtocol = json .loads (await self . _websocket . recv () )
143
+ raw_context : WebSocketClientProtocol = json .loads (message )
144
144
if raw_context .get ('msg' ) == 'ping' :
145
145
await self ._rtapi .pong ()
146
146
return None
@@ -193,9 +193,9 @@ async def run(self) -> None:
193
193
self .check_app_name (app )
194
194
await app .setup ()
195
195
196
- while True :
196
+ async for message in websocket :
197
197
try :
198
- await self .loop ( )
198
+ asyncio . create_task ( self .message_handler ( message ) )
199
199
except ClientResponseError as exc :
200
200
LOGGER .error (exc )
201
201
except ConnectionClosedOK :
You can’t perform that action at this time.
0 commit comments