Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Question: rpc.py line 256 #29

Open
semigodking opened this issue Jun 15, 2018 · 5 comments
Open

Question: rpc.py line 256 #29

semigodking opened this issue Jun 15, 2018 · 5 comments

Comments

@semigodking
Copy link
Contributor

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!

@fscherf
Copy link
Contributor

fscherf commented Jun 15, 2018

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.

@semigodking
Copy link
Contributor Author

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

@fscherf
Copy link
Contributor

fscherf commented Jun 15, 2018

@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.

@semigodking
Copy link
Contributor Author

semigodking commented Jun 15, 2018 via email

@fscherf
Copy link
Contributor

fscherf commented Jun 15, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants