-
Notifications
You must be signed in to change notification settings - Fork 5
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
Subscription to tasks and listening on / instead of /task-id #4
Comments
That would be nice. We don't actually use wscelery anymore since we stopped using celery, but we'd be happy to take patches. |
I agree with you, this was on our project roadmap before we moved away from celery. If you'd like to have a look, you'd need to handle messages in the I was thinking something along the lines of: class WebSocketHandler(tornado.websocket.WebSocketHandler):
def initialize(self, events, allow_origin=None):
self.events = events
self.listeners = []
self.allow_origin = allow_origin
def check_origin(self, origin):
if not self.allow_origin:
return super().check_origin(origin)
match = re.match(self.allow_origin, origin)
return match is not None
def _handle_event(self, event):
self.write_message(parse_event(event))
def on_message(self, task_id):
self.listeners.append(task_id)
self.events.add_listener(task_id, self._handle_event)
def on_close(self):
map(self.events.remove_listener, self.listeners) I don't have time to make these changes and test that the behaviour works as expected, but PR's are more than welcome. |
@kalouantonis what are you using instead of Celery? I find that all of the frontends for Celery are hopelessly outdated... |
Hey @soer7022, I'm using elixir/erlang nowadays to complete the same tasks without the need for a framework so to speak. I'd be happy to add maintainers to this project, if anyone is interested, and if @johan-sports agrees. |
Awesome project, kudos.
It would be great if the client could create a single WebSocket connection to / instead of /task-id, subscribe to task or tasks and then receive events.
The text was updated successfully, but these errors were encountered: