-
Notifications
You must be signed in to change notification settings - Fork 63
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
Implement connection handling for graphql-transport-ws
sub protocol.
#126
Implement connection handling for graphql-transport-ws
sub protocol.
#126
Conversation
Added some tests. I copied Also fixed status codes, using Any request to fix, I'd like to do it. |
I'd like to look at this, but don't know if you've signed the CLA? |
Thanks for considering. |
@@ -2,7 +2,7 @@ | |||
{:tick | |||
{:description "A subscription response." | |||
:fields {:time_ms {:type String | |||
:description "Time when tick is emittied (as string-ified long milliseconds since epoch)." | |||
:description "Time when tick is emitted (as string-field long milliseconds since epoch)." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, one was a typo, but I meant "string-ified" as the difference between 42
and "42"
. The latter is string-ified, i.e., a numeric string.
@@ -249,12 +249,13 @@ | |||
"}")) | |||
|
|||
(defn graphiql-response | |||
[api-path subscriptions-path asset-path ide-headers ide-connection-params] | |||
[api-path subscriptions-path asset-path ide-headers ide-connection-params ide-use-legacy-ws-client] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about the point where it's time to switch from many parameters to an options map.
specified by [graphql-ws](https://github.com/enisdenjo/graphql-ws/blob/v5.7.0/PROTOCOL.md)" | ||
(reify Ws-Sub-Protocol | ||
(sub-protocol-name [_] "graphql-transport-ws") | ||
(connection-loop [self session _ ws-data-ch response-data-ch context] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really not using self here. Also, from bitter experience, I tend to have methods in reified objects delegate to a function; otherwise you hit some oddities about debugging and reloading.
@@ -2,7 +2,7 @@ | |||
{:tick | |||
{:description "A subscription response." | |||
:fields {:time_ms {:type String | |||
:description "Time when tick is emittied (as string-ified long milliseconds since epoch)." | |||
:description "Time when tick is emitted (as string-field long milliseconds since epoch)." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ified
wasn't really a typo, I was trying to express that time was a numeric string, not a number.
I'm seeing test failures when I build locally.
Looks like some kind of off-by-one error on the message ids. |
I'm beginning to ramp up towards a milestone release in January; do you have time to look into the above problems? |
Getting close to a lacinia 1.2 release, it would be nice to pursue this for a lacinia-pedestal release. |
Fixes #123
It works. I have checked with
demo
schema on GraphiQL withgraphql-ws
client.But some TODOs remain.
In particular, it is better to deal with the handling of the status code later. I'm not good at
pedestal.jetty
and didn't know how to solve these problems well.I would also like to add some tests, but I would appreciate any advice on the testing.