Class WebSocketImpl

    • Constructor Detail

      • WebSocketImpl

        WebSocketImpl​(ChannelOwner parent,
                      java.lang.String type,
                      java.lang.String guid,
                      com.google.gson.JsonObject initializer)
    • Method Detail

      • onClose

        public void onClose​(java.util.function.Consumer<WebSocket> handler)
        Description copied from interface: WebSocket
        Fired when the websocket closes.
        Specified by:
        onClose in interface WebSocket
      • onFrameReceived

        public void onFrameReceived​(java.util.function.Consumer<WebSocketFrame> handler)
        Description copied from interface: WebSocket
        Fired when the websocket receives a frame.
        Specified by:
        onFrameReceived in interface WebSocket
      • onFrameSent

        public void onFrameSent​(java.util.function.Consumer<WebSocketFrame> handler)
        Description copied from interface: WebSocket
        Fired when the websocket sends a frame.
        Specified by:
        onFrameSent in interface WebSocket
      • onSocketError

        public void onSocketError​(java.util.function.Consumer<java.lang.String> handler)
        Description copied from interface: WebSocket
        Fired when the websocket has an error.
        Specified by:
        onSocketError in interface WebSocket
      • offSocketError

        public void offSocketError​(java.util.function.Consumer<java.lang.String> handler)
        Description copied from interface: WebSocket
        Removes handler that was previously added with onSocketError(handler).
        Specified by:
        offSocketError in interface WebSocket
      • waitForFrameReceived

        public WebSocketFrame waitForFrameReceived​(WebSocket.WaitForFrameReceivedOptions options,
                                                   java.lang.Runnable code)
        Description copied from interface: WebSocket
        Performs action and waits for a frame to be sent. If predicate is provided, it passes WebSocketFrame value into the predicate function and waits for predicate(webSocketFrame) to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is received.
        Specified by:
        waitForFrameReceived in interface WebSocket
        code - Callback that performs the action triggering the event.
      • waitForFrameSent

        public WebSocketFrame waitForFrameSent​(WebSocket.WaitForFrameSentOptions options,
                                               java.lang.Runnable code)
        Description copied from interface: WebSocket
        Performs action and waits for a frame to be sent. If predicate is provided, it passes WebSocketFrame value into the predicate function and waits for predicate(webSocketFrame) to return a truthy value. Will throw an error if the WebSocket or Page is closed before the frame is sent.
        Specified by:
        waitForFrameSent in interface WebSocket
        code - Callback that performs the action triggering the event.
      • isClosed

        public boolean isClosed()
        Description copied from interface: WebSocket
        Indicates that the web socket has been closed.
        Specified by:
        isClosed in interface WebSocket
      • url

        public java.lang.String url()
        Description copied from interface: WebSocket
        Contains the URL of the WebSocket.
        Specified by:
        url in interface WebSocket
      • handleEvent

        void handleEvent​(java.lang.String event,
                         com.google.gson.JsonObject parameters)
        Overrides:
        handleEvent in class ChannelOwner