Overview
GraphQL over WebSocket with authentication through the "connection_init" message.
GreetingController demonstrates
access to the authenticated user.
Features
- WebSocket client and server.
- Intercept
"connection_init"message on client and server. - Encode and decode JWT token.
- Context propagation and access to
Authenticationin GreetingController. - Integration tests with live server.
- WebMvc or WebFlux as server transport.
Configuration
WebMvcSecurityConfig and
WebFluxSecurityConfig configure the
AuthenticationWebSocketInterceptor to perform authentication. See the
reference docs.
To switch between WebMvc or WebFlux as the transport, comment in and out
spring-boot-starter-web and spring-boot-starter-websocket in build.gradle.
Running
- Run GreetingApplication from your IDE, or
./gradlew bootRunfrom the command line to start the server. - Run GreetingClient, or
./gradlew clientRunto perform a subscription.
Or you can run the integration tests in GreetingApplicationTests.