leangen / graphql-spqr-spring-boot-starter

Spring Boot 2 starter powered by GraphQL SPQR
Apache License 2.0
276 stars 68 forks source link

PerConnectionApolloHandler sends wrong sub-protocol #147

Open westito opened 6 months ago

westito commented 6 months ago

I tried subscribe with Postman but it fails with Server sent no subprotocol:

Képernyőfotó 2024-04-27 - 16 39 11

I found that the client sends graphql-transport-ws sub-protocol but server only tests to graphql-ws because getSubProtocols() return only that. The official protocol is the graphql-transport-ws as you see here: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md

westito commented 6 months ago

Meanwhile I realised the implemented protocol simply older than the currently recommended that Postman uses.

kaqqao commented 6 months ago

Yes, true. I figured there's no point in implementing the new protocol in SPQR since Spring itself already does. I'll release SPQR Starter 2.0.0.rc1 soon, possibly even today. The new version removes SPQR's entire communication layer and uses Spring directly. This will obviously be a breaking change, but it shouldn't cause too much trouble. In the meantime, it's possible to already use Spring for communication with the current SPQR starter. I've been using it in production like that myself ever since Spring for GraphQL was released. It's pretty straightforward, I can post an example later.