-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add GraphQL subscriptions support via WebSocket #14
Comments
The PR linked here was failing in their Travis setup, due to use of |
Tried setting up a small project to test WebSockets + Vue, using the pending pull request. Alas found a few issues in
Though I am hoping to be wrong, and that we just need to use the API in a different way to work around the issues I found 🤞 |
When implementing the Tornado handler for WebSockets, it's important to remember to allow different origins. See their docs for reference. Here's how to disable globally (bad probably?) def check_origin(self, origin):
return True Ideally we would either disable globally but add a big def check_origin(self, origin):
parsed_origin = urllib.parse.urlparse(origin)
return parsed_origin.netloc.endswith(".mydomain.com") Though it's not clear to me what information we would have at that point to validate the other origin. |
Another note (thanks to @dwsutherland for reminding me), should a message like the following is displayed in logs: This is caused due to a missing property in Tornado handler executor. We need to include the |
Moving to 0.2 as this task requires further work on both Cylc UI Server & Cylc UI, and will take time - but hopefully can be delivered in 0.2 |
Doing the Python part this week, aiming at starting this task next Monday 👍 |
See #11 for previous discussion. The UI Server is a Tornado project, that inherits classes from JupyterHub Tornado project (for things like authentication).
In #11 and #13 it's getting an extra layer with Graphene, an open source library for Python that implements GraphQL.
However, GraphQL subscriptions require the base layer of Graphene for GraphQL, plus an extra library to handle the query subscription (which is basically a mechanism for sending to clients the output of a query whenever if changed), the normal way being via WebSockets.
WebSockets are supported by Tornado out of the box. What we are missing, is actually the extra layer of integration with Tornado. That is done via the Graphele
graphql-ws
project, which has one Pull Request to add support to tornado still pending.Once that pull request is merged, we can add that library in our
setup.py
, and fix this issue. An alternative in case we need that before the pull request is merged, is simply fork it and use our own until it is merged.The text was updated successfully, but these errors were encountered: