-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduled messages sent by server #245
Comments
From my point of view is this issue similar to #74 |
Yes, it is surely related to that issue but not equal. Here the problem is not how to run scheduled jobs but how to interrupt scheduled jobs if no one is listening. Both using |
Yes i solving this using cache, i save all users and count to the cache because for me is not critical to have this persistent, you could easily handle ws connect and save all information which you needs, but maybe would be good to have native way for doing this @andrewgodwin what you thinking about storing this information in channel backend ? I think that we could propose some preferred solutions for doing this |
I would say this is actually #174 in that case (have a way to see if a group is empty or not), which I am still not totally okay making the channel backend deliver as a status, because it tightens the contract a little more. Is there a reason you don't just want to leave it sending into the void? A Group.send() with no listening channels is basically free. |
I write simple code for handling group related data which now uses cache but is backend independent
as you mention its extra calls on client connect code lives here https://github.com/leonardo-modules/leonardo-channels/blob/feature/ws_frontend/leonardo_channels/managers/base.py |
Feature requested for this was done. |
I need to create a webpage that shows the status of some application on server side.
For doing this I want clients to connect to server via websockets and the server pushing messages every n seconds on that websockets. This can be easily done using
celery
scheduled tasks. In particular I have a code similar to thiswhere the channel is associated with a consumer that collects the information from the system and sends them to the
Group
This works pretty good. My problem is that collecting the status can be a little bit demanding and I don't want that piece of code being executed when no client is actually receiving those information. (It will happen often since it is a webpage built for being used by few users).
At the moment I solved this by setting a boolean variable and putting a check on it onto the
ws_status
consumer: ifFalse
information are not collected, ifTrue
they are collected, sent to the group and the variable is set toFalse
. Then, at the client side, I have a script that sends an acknowledgement on receiving a new status, and a corresponding consumer on the server that set again the variable toTrue
on receiving acknowledgment.But I don't think this is a good solution, at the moment it works but maybe there are some caveats that I have not yet found.
The text was updated successfully, but these errors were encountered: