wsrpc / wsrpc-aiohttp

WebSocket RPC for aiohttp
Apache License 2.0
30 stars 7 forks source link

message from the server side? #68

Open atitoff opened 3 months ago

atitoff commented 3 months ago

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.

mosquito commented 3 months ago

Here it is https://github.com/wsrpc/wsrpc-aiohttp/blob/master/docs/source/examples/server.py#L58-L64

atitoff commented 3 months ago

how can I call "getJoke(self)" from another class instance? in your example they are not called anywhere...

mosquito commented 3 months ago

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.

atitoff commented 3 months ago

The server cannot be the initiator of the message? Got it, I’ll write my own wrapper for the aiohttp websockets

mosquito commented 3 months ago

You have any option for trigger event on the server side.

This library provides contract and implementation of the transport.