Class GraphQLReactiveWebSocketHandler<R,​T>

java.lang.Object
com.graphql_java_generator.client.GraphQLReactiveWebSocketHandler<R,​T>
Type Parameters:
R - The class that is generated from the subscription definition in the GraphQL schema. It contains one attribute, for each available subscription. In the incoming messages, the data JSON field of the GraphQL server response is of this type. So it is needed to decode the received JSON.
T - The type that must be returned by the query or mutation: it's the class that maps to the GraphQL type returned by this subscription. In other words, it's the java type that matches the field in the subscription GraphQL type, for this subscribed subscription.
All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.web.reactive.socket.WebSocketMessage>, org.springframework.web.reactive.socket.WebSocketHandler, reactor.core.CoreSubscriber<org.springframework.web.reactive.socket.WebSocketMessage>

public class GraphQLReactiveWebSocketHandler<R,​T>
extends java.lang.Object
implements org.springframework.web.reactive.socket.WebSocketHandler, reactor.core.CoreSubscriber<org.springframework.web.reactive.socket.WebSocketMessage>
This class implements the Web Socket, as needed by the Spring Web Socket implementation.
Author:
etienne-sf
  • Constructor Summary

    Constructors 
    Constructor Description
    GraphQLReactiveWebSocketHandler​(java.lang.String request, java.lang.String subscriptionName, SubscriptionCallback<T> subscriptionCallback, java.lang.Class<R> subscriptionType, java.lang.Class<T> messsageType)  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.web.reactive.socket.WebSocketSession getSession()  
    reactor.core.publisher.Mono<java.lang.Void> handle​(org.springframework.web.reactive.socket.WebSocketSession session)  
    void onComplete()  
    void onError​(java.lang.Throwable t)  
    void onNext​(org.springframework.web.reactive.socket.WebSocketMessage message)
    The callback that will receive the messages from the web socket.
    void onSubscribe​(org.reactivestreams.Subscription s)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface reactor.core.CoreSubscriber

    currentContext

    Methods inherited from interface org.springframework.web.reactive.socket.WebSocketHandler

    getSubProtocols
  • Constructor Details

  • Method Details

    • handle

      public reactor.core.publisher.Mono<java.lang.Void> handle​(org.springframework.web.reactive.socket.WebSocketSession session)
      Specified by:
      handle in interface org.springframework.web.reactive.socket.WebSocketHandler
    • getSession

      public org.springframework.web.reactive.socket.WebSocketSession getSession()
    • onNext

      public void onNext​(org.springframework.web.reactive.socket.WebSocketMessage message)
      The callback that will receive the messages from the web socket. It will map these JSON messages to the relevant java class, and call the application callback with this java objects
      Specified by:
      onNext in interface org.reactivestreams.Subscriber<R>
      Parameters:
      message - The received JSON message
    • onError

      public void onError​(java.lang.Throwable t)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<R>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<R>
    • onSubscribe

      public void onSubscribe​(org.reactivestreams.Subscription s)
      Specified by:
      onSubscribe in interface reactor.core.CoreSubscriber<R>
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<R>