org.vertx.java.core.sockjs

## Class SockJSSocket

- java.lang.Object
- - org.vertx.java.core.sockjs.SockJSSocket

- All Implemented Interfaces:
    ReadStream, WriteStream

      public abstract class SockJSSocket
      extends java.lang.Object
      implements ReadStream, WriteStream

  You interact with SockJS clients through instances of SockJS socket.

  The API is very similar to `WebSocket`. It implements both `ReadStream` and `WriteStream` so it can be used with `Pump` to pump data with flow control.

  Instances of this class are not thread-safe.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.concurrent.atomic.AtomicInteger` | `cnt`
    `protected Vertx` | `vertx`
    `java.lang.String` | `writeHandlerID` When a `SockJSSocket` is created it automatically registers an event handler with the event bus, the ID of that handler is given by `writeHandlerID`.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SockJSSocket(Vertx vertx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected void` | `finalize()`

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

      `clone, equals, 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

    - #### vertx

          protected final Vertx vertx

    - #### writeHandlerID

          public final java.lang.String writeHandlerID

      When a `SockJSSocket` is created it automatically registers an event handler with the event bus, the ID of that handler is given by `writeHandlerID`.

      Given this ID, a different event loop can send a buffer 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 socket. This allows you to write data to other sockets which are owned by different event loops.

    - #### cnt

          public static java.util.concurrent.atomic.AtomicInteger cnt

  - ### Constructor Detail

    - #### SockJSSocket

          protected SockJSSocket(Vertx vertx)

  - ### Method Detail

    - #### close

          public void close()

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `java.lang.Object`
      Throws:
        `java.lang.Throwable`