Package: io.vertx.groovy.core.http

## [Groovy] Class WebSocketBaseImpl

- io.vertx.groovy.core.http.WebSocketBaseImpl

- All Implemented Interfaces and Traits:
    WebSocketBase

      @groovy.transform.CompileStatic
      class WebSocketBaseImpl
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and description
    `WebSocketBaseImpl (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.String` | `binaryHandlerID()` When a `Websocket` is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method.
    `void` | `close()` Close the WebSocket.
    `WebSocketBase` | `closeHandler(io.vertx.core.Handler<java.lang.Void> handler)` Set a close handler.
    `WebSocketBase` | `drainHandler(io.vertx.core.Handler<java.lang.Void> handler)`
    `void` | `end(Buffer t)` Same as WebSocketBase.end but writes some data to the stream before ending.
    `void` | `end()` Calls WebSocketBase.close
    `WebSocketBase` | `endHandler(io.vertx.core.Handler<java.lang.Void> endHandler)`
    `WebSocketBase` | `exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler)`
    `WebSocketBase` | `frameHandler(io.vertx.core.Handler<WebSocketFrame> handler)` Set a frame handler on the connection.
    `java.lang.Object` | `getDelegate()`
    `WebSocketBase` | `handler(io.vertx.core.Handler<Buffer> handler)`
    `SocketAddress` | `localAddress()` @return Returns: the local address for this socket
    `WebSocketBase` | `pause()`
    `SocketAddress` | `remoteAddress()` @return Returns: the remote address for this socket
    `WebSocketBase` | `resume()`
    `WebSocketBase` | `setWriteQueueMaxSize(int maxSize)`
    `java.lang.String` | `textHandlerID()` When a `Websocket` is created it automatically registers an event handler with the eventbus, the ID of that handler is given by `textHandlerID`.
    `WebSocketBase` | `write(Buffer data)`
    `WebSocketBase` | `writeBinaryMessage(Buffer data)` Writes a (potentially large) piece of binary data to the connection.
    `WebSocketBase` | `writeFinalBinaryFrame(Buffer data)` Write a final WebSocket binary frame to the connection
    `WebSocketBase` | `writeFinalTextFrame(java.lang.String text)` Write a final WebSocket text frame to the connection
    `WebSocketBase` | `writeFrame(WebSocketFrame frame)` Write a WebSocket frame to the connection
    `boolean` | `writeQueueFull()` This will return `true` if there are more bytes in the write queue than the value set using WebSocketBase.setWriteQueueMaxSize

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### WebSocketBaseImpl(java.lang.Object delegate)

  - ### Method Detail

    - #### java.lang.String binaryHandlerID()

      When a `Websocket` is created it automatically registers an event handler with the event bus - the ID of that handler is given by this method.

      Given this ID, a different event loop can send a binary frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.

      Returns:
        the binary handler id

    - #### void close()

      Close the WebSocket.

    - #### WebSocketBase closeHandler(io.vertx.core.Handler<java.lang.Void> handler)

      Set a close handler. This will be called when the WebSocket is closed.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler

    - #### WebSocketBase drainHandler(io.vertx.core.Handler<java.lang.Void> handler)

    - #### void end(Buffer t)

      Same as WebSocketBase.end but writes some data to the stream before ending.

      Parameters:
        t

    - #### void end()

      Calls WebSocketBase.close

    - #### WebSocketBase endHandler(io.vertx.core.Handler<java.lang.Void> endHandler)

    - #### WebSocketBase exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler)

    - #### WebSocketBase frameHandler(io.vertx.core.Handler<WebSocketFrame> handler)

      Set a frame handler on the connection. This handler will be called when frames are read on the connection.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler

    - #### java.lang.Object getDelegate()

    - #### WebSocketBase handler(io.vertx.core.Handler<Buffer> handler)

    - #### SocketAddress localAddress()

      Returns:
        the local address for this socket

    - #### WebSocketBase pause()

    - #### SocketAddress remoteAddress()

      Returns:
        the remote address for this socket

    - #### WebSocketBase resume()

    - #### WebSocketBase setWriteQueueMaxSize(int maxSize)

    - #### java.lang.String textHandlerID()

      When a `Websocket` is created it automatically registers an event handler with the eventbus, the ID of that handler is given by `textHandlerID`.

      Given this ID, a different event loop can send a text frame to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other WebSockets which are owned by different event loops.

      Returns:

    - #### WebSocketBase write(Buffer data)

    - #### WebSocketBase writeBinaryMessage(Buffer data)

      Writes a (potentially large) piece of binary data to the connection. This data might be written as multiple frames if it exceeds the maximum WebSocket frame size.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `data` - the data to write

    - #### WebSocketBase writeFinalBinaryFrame(Buffer data)

      Write a final WebSocket binary frame to the connection

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `data` - The data to write

    - #### WebSocketBase writeFinalTextFrame(java.lang.String text)

      Write a final WebSocket text frame to the connection

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `text` - The text to write

    - #### WebSocketBase writeFrame(WebSocketFrame frame)

      Write a WebSocket frame to the connection

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `frame` - the frame to write

    - #### boolean writeQueueFull()

      This will return `true` if there are more bytes in the write queue than the value set using WebSocketBase.setWriteQueueMaxSize

      Returns:
        true if write queue is full