I think my question is very easy and stupid, but I read a lot of materials and can't imagine how to do what I want.
So, I use websockets library, and I have this algorythm:
# 1. get connection and start handle it
async def main_request_handler(ws, path):
proxy = Proxy()
try:
await proxy.start(ws, path)
2. inside start I create second websocket to pass requests from ws and receive answers to send them to ws
while True:
request_raw = await self.ws_server.recv()
await self.process_request_from_server(request_raw)
The problem is, I need to use one websocket server connection for multiply
ws clients, and I need to pass to everyone the same answer from ws_server. Now I get only one response, due to .recv() returns value only for one of the 'subscribers'.
How to fix this? Please note, that I use while True and async
minimal example? So I can try your code?