aiohttp-json-rpc icon indicating copy to clipboard operation
aiohttp-json-rpc copied to clipboard

Question: rpc.py line 256

Open semigodking opened this issue 7 years ago • 5 comments
trafficstars

May I know where the 'send_notification' method is defined in rpc.py line 256?

request.ws.send_notification(topic, self.state[topic])

Thank you!

semigodking avatar Jun 15 '18 01:06 semigodking

Hi @semigodking,

i am very sorry, you discoverd a bug here. At the moment i am working on a release that fixes the broken publish-subscribe system. I missed the code you wonder about.

As i started this project, all message encoding and decoding was part of a custom subclass of the aiohttp websocket class (therefore "ws"). We splitted this code in multiple libraries because we have a rpc client library now that needs message processing as well. If you want to send a notification based on a request (no broadcasting) you use aiohttp_json_rpc.communication.JsonRpcRequest.send_notification now.

Thx for pointing this issue out, i fixed the wrong call and added a test.

fscherf avatar Jun 15 '18 09:06 fscherf

Hi @fscherf, About these two lines, i am wondering why they are needed. They send staled notification whenever a client subscribes a topic.

semigodking avatar Jun 15 '18 10:06 semigodking

@semigodking If you subscribe to a topic on which were notifications send you missed, you get the last one. We call this 'state' and use it for progress informations on long running tasks. So if you connect on 10% of the task you dont have to wait for 11% to see the current progress.

fscherf avatar Jun 15 '18 11:06 fscherf

Looks like this feature is not acceptable by some time sensitive applications.

On Fri, Jun 15, 2018, 19:06 Florian Scherf [email protected] wrote:

@semigodking https://github.com/semigodking If you subscribe to a topic on which were notifications send you missed, you get the last one. We call this 'state' and use it for progress informations on long running tasks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pengutronix/aiohttp-json-rpc/issues/29#issuecomment-397588446, or mute the thread https://github.com/notifications/unsubscribe-auth/AB-rj_KmsTtIzyTTaPlglLIzTEGgY_cSks5t85UbgaJpZM4Uo54x .

semigodking avatar Jun 15 '18 11:06 semigodking

you are right. you could make it configurable in a pull request :)

fscherf avatar Jun 15 '18 11:06 fscherf