Class WebSocketRequestHandler

    • Method Detail

      • pushAsync

        public Future<VoidpushAsync​(CharSequence message,
                                      long timeout)
        Description copied from interface: IWebSocketRequestHandler
        Pushes a text message to the client in an asynchronous way.
        Specified by:
        pushAsync in interface IWebSocketRequestHandler
        Parameters:
        message - the text message to push to the client if the web socket connection is open
        timeout - the timeout for operation
        Returns:
        a Future representing the send operation. Or null if connection is closed.
      • push

        public void push​(byte[] message,
                         int offset,
                         int length)
        Description copied from interface: IWebSocketRequestHandler
        Pushes a binary message to the client.
        Specified by:
        push in interface IWebSocketRequestHandler
        Parameters:
        message - the binary message to push to the client if the web socket connection is open
        offset - the offset to start to read from the message
        length - how many bytes to read from the message
      • pushAsync

        public Future<VoidpushAsync​(byte[] message,
                                      int offset,
                                      int length)
        Description copied from interface: IWebSocketRequestHandler
        Pushes a binary message to the client.
        Specified by:
        pushAsync in interface IWebSocketRequestHandler
        Parameters:
        message - the binary message to push to the client if the web socket connection is open
        offset - the offset to start to read from the message
        length - how many bytes to read from the message
        Returns:
        a Future representing the send operation. Or null if connection is closed.
      • pushAsync

        public Future<VoidpushAsync​(byte[] message,
                                      int offset,
                                      int length,
                                      long timeout)
        Description copied from interface: IWebSocketRequestHandler
        Pushes a binary message to the client.
        Specified by:
        pushAsync in interface IWebSocketRequestHandler
        Parameters:
        message - the binary message to push to the client if the web socket connection is open
        offset - the offset to start to read from the message
        length - how many bytes to read from the message
        timeout - the timeout for operation
        Returns:
        a Future representing the send operation. Or null if connection is closed.
      • shouldPushWhenEmpty

        protected boolean shouldPushWhenEmpty()
        Returns:
        if true then EMPTY partial updates will se send. If false then EMPTY partial updates will be skipped. A possible use case is: a page receives and a push event but no one is listening to it, and nothing is added to WebSocketRequestHandler thus no real push to client is needed. For compatibilities this is set to true. Thus EMPTY updates are sent by default.
      • detach

        public void detach​(IRequestCycle requestCycle)
        Description copied from interface: IRequestHandler
        This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.
        Specified by:
        detach in interface IRequestHandler
        Parameters:
        requestCycle - the current request cycle