-
Notifications
You must be signed in to change notification settings - Fork 276
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
[ FEATURE ] Add websockets #495
Comments
Do you have some examples? Or possibly docs for implementing it in python? I found this https://pypi.python.org/pypi/websockets, but that's min python 3.3 |
Have a look at the docs for tornado, from what I can see there's already an implementation built in, you just need to use it like we already do with normal http requests. |
Ooh cool! I'll see if I can replace the messages with this as a POC |
How should we create the websocket route? Ive got something working using /ws/(.*). But maybe you also want to make this part of the versioned API? |
Maybe we just use Like this and then we can just check if the message we get from the server has the event we need.
|
@OmgImAlexis That sounds good. If in the future we find that its needed we can extend this to additional routes if needed, possibly even mirroring the APIv2 endpoints for route-specific websockets. |
hmm just discovered that the ws is opened blocking other requests. Meaning it's running under the Tornado thread. But looping in the open() method like shown below, will not work. Maybe create a new thread specific for checking the ui messages?
|
@p0psicles I'd say open a new thread just for websockets since it'll need to run independently to the web ui. |
Hmm. For what i've read, I have to remove any heavy processing from the handler, and move it to a separate thread. Meaning that the wshandler will only be called, when something has to be send over the socket. This means I have to at least get rid of the loop. But the RequestHandler doesn't work like this. That one has a limited number of threads, that I can use for each request. I'd rather also have the websockets work like that. |
Would something like this not work? Since a websocket connection is kept open you should be able to just send anything through as a message and the browser should be able to receive it.
|
Added to master feature request list - discussion for feature will continue here even though issue is closed. |
If websockets were added then we could use them to update the page as new changes come along instead of having to rely on polling the server for new changes. This would also fix the
get_messages
spam that we currently have.The text was updated successfully, but these errors were encountered: