org.vertx.java.core.http

## Class ServerWebSocket

- java.lang.Object
- - org.vertx.java.core.http.WebSocket
  - - org.vertx.java.core.http.ServerWebSocket

- All Implemented Interfaces:
    ReadStream, WriteStream

      public abstract class ServerWebSocket
      extends WebSocket

  Represents a server side WebSocket that is passed into a the websocketHandler of an `HttpServer`

  Instances of this class are not thread-safe

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.String` | `path` The path the websocket is attempting to connect at

    - ### Fields inherited from class org.vertx.java.core.http.WebSocket

      `binaryHandlerID, textHandlerID`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ServerWebSocket(java.lang.String path, java.lang.String binaryHandlerID, java.lang.String textHandlerID)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `reject()` Reject the WebSocket

    - ### Methods inherited from class org.vertx.java.core.http.WebSocket

      `close, closedHandler, writeBinaryFrame, writeTextFrame`

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface org.vertx.java.core.streams.ReadStream

      `dataHandler, endHandler, exceptionHandler, pause, resume`

    - ### Methods inherited from interface org.vertx.java.core.streams.WriteStream

      `drainHandler, exceptionHandler, setWriteQueueMaxSize, writeBuffer, writeQueueFull`

- - ### Field Detail

    - #### path

          public final java.lang.String path

      The path the websocket is attempting to connect at

  - ### Constructor Detail

    - #### ServerWebSocket

          protected ServerWebSocket(java.lang.String path,
                         java.lang.String binaryHandlerID,
                         java.lang.String textHandlerID)

  - ### Method Detail

    - #### reject

          public abstract void reject()

      Reject the WebSocket

      Calling this method from the websocketHandler gives you the opportunity to reject the websocket, which will cause the websocket handshake to fail by returning a 404 response code.

      You might use this method, if for example you only want to accept websockets with a particular path.