graphql-spring-boot icon indicating copy to clipboard operation
graphql-spring-boot copied to clipboard

graphql-spring-boot-starter 12.0.0 breaks subscription support

Open chattling opened this issue 5 years ago • 3 comments

When I use v12.0.0 of graphql-spring-boot, not able to connect to subscription endpoint

Steps to reproduce the behavior: I created sample example project: https://github.com/chattling/kickstart-sub-test Start the project and navigate to http://localhost:8080/playground Try to run subscription: subscription { pong } Getting error: { "error": "Could not connect to websocket endpoint ws://localhost:8080/subscriptions. Please check if the endpoint url is correct." }

Expected behavior Playground supposed to connect to ws endpoint

Additional context Just for contrast. If I downgrade graphql-spring-boot to v11.0.0 and add playground dependency to pom.xml (since 11.0.0 starter doesn't do it automatically), then I am able to connect to ws endpoint with Playground. Also it is possible to cause subscription to get data by using query: { ping }

chattling avatar Nov 14 '21 16:11 chattling

This should be raised in discussions instead of a bug. V12 has this as a breaking change, since it nog longer pulls in spring boot starters but instead relies on you to define the starters you need. This means you're missing the spring boot web socket starter. Add that one and it'll work again.

oliemansm avatar Nov 14 '21 16:11 oliemansm

@oliemansm , thanks, I figured it out. Added spring boot websocket dependency:

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

It works now.

chattling avatar Nov 14 '21 16:11 chattling

It's the spring-boot-starter-websocket of the spring framework group. Not related to this project.

Could be release notes are limited or you'd have to follow a link at this time to get to that info. Docs is limited and haven't had time to update this.

oliemansm avatar Nov 14 '21 16:11 oliemansm