Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.vertx.groovy.core.sockjs
[Groovy] Class SockJSSocket

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

All Implemented Interfaces:
  ReadStream, WriteStream

    abstract class SockJSSocket

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.

Authors:
  Tim Fox

Constructor Summary
`protected SockJSSocket(SockJSSocket jSocket)`

Method Summary
`void` | `close()` Close the socket
`java.lang.String` | `getWriteHandlerID()` When a `SockJSSocket` is created it automatically registers an event handler with the event bus, the ID of that handler is given by `writeHandlerID`.
`SockJSSocket` | `leftShift(Buffer buff)` Write a Buffer to the socket
`SockJSSocket` | `leftShift(java.lang.String str)` Write a String to the socket

Methods inherited from 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

### SockJSSocket

    protected SockJSSocket(SockJSSocket jSocket)

Method Detail

### close

    void close()

  Close the socket

### getWriteHandlerID

    java.lang.String getWriteHandlerID()

  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.

### leftShift

    SockJSSocket leftShift(Buffer buff)

  Write a Buffer to the socket
  Returns:
    reference to this so operations can be chained

### leftShift

    SockJSSocket leftShift(java.lang.String str)

  Write a String to the socket
  Returns:
    reference to this so operations can be chained

Groovy Documentation