message from the server side?
Can I initiate a message from the server side? I didn't find it in the examples. Only if the request comes from the client side can I send a notification.
Here it is https://github.com/wsrpc/wsrpc-aiohttp/blob/master/docs/source/examples/server.py#L58-L64
how can I call "getJoke(self)" from another class instance? in your example they are not called anywhere...
client calls getJoke, server calls joke on the client, after the client returns the result, that result is a placed to the getJoke left on await.
The server cannot be the initiator of the message? Got it, I’ll write my own wrapper for the aiohttp websockets
You have any option for trigger event on the server side.
This library provides contract and implementation of the transport.
- You may notify all connected clients https://github.com/wsrpc/wsrpc-aiohttp/blob/master/wsrpc_aiohttp/websocket/handler.py#L176-L195
- You may create a PubSub route
class Route(PrefixRoute): SUBSCRIBERS = set() def init(self): self.SUBSCRIBERS.add(self.socket) @classmethod async def notify_all(cls, **kwargs): await asyncio.gather(*[ sock.proxy.notify(**kwargs) for sock in cls.SUBSCRIBERS ])