Class SubscriptionClientWebSocket<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. The data tag of the GraphQL server response will be mapped into an instance of this class.
    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.

    @WebSocket
    public class SubscriptionClientWebSocket<R,​T>
    extends java.lang.Object
    This class implements the Web Socket, as needed by the jetty's Web Socket implementation.
    Author:
    etienne-sf
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onClose​(int statusCode, java.lang.String reason)
      Notify the application, when the Web Socket is closed.
      void onConnect​(org.eclipse.jetty.websocket.api.Session session)
      As soon as the Web Socket is connected, this method executes the subscription GraphQL request
      void onError​(java.lang.Throwable cause)
      Notify the application, when an error occurs.
      void onMessage​(java.lang.String msg)
      Each message is received as text, that is a standard GraphQL response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onConnect

        @OnWebSocketConnect
        public void onConnect​(org.eclipse.jetty.websocket.api.Session session)
        As soon as the Web Socket is connected, this method executes the subscription GraphQL request
        Parameters:
        session -
      • onMessage

        @OnWebSocketMessage
        public void onMessage​(java.lang.String msg)
        Each message is received as text, that is a standard GraphQL response. This method maps this GraphQL response to the POJOs that have been generated from the GraphQL Schema, and notify the application through the SubscriptionCallback that has been provided, when the subscription is executed.
        Parameters:
        msg -
      • onClose

        @OnWebSocketClose
        public void onClose​(int statusCode,
                            java.lang.String reason)
        Notify the application, when the Web Socket is closed. This notification is done through the SubscriptionCallback that has been provided, when the subscription is executed.
        Parameters:
        msg -
      • onError

        @OnWebSocketError
        public void onError​(java.lang.Throwable cause)
        Notify the application, when an error occurs. This notification is done through the SubscriptionCallback that has been provided, when the subscription is executed.
        Parameters:
        msg -