org.jetlang.web

## Class WebSocketConnectionImpl

- java.lang.Object
- - org.jetlang.web.WebSocketConnectionImpl

All Implemented Interfaces:
  Executor, org.jetlang.core.Disposable, org.jetlang.core.DisposingExecutor, org.jetlang.core.Scheduler, WebSocketConnection

    public class WebSocketConnectionImpl
    extends Object
    implements WebSocketConnection

### Field Summary

Fields
`static byte[]` `empty`
`static byte` `OPCODE_BINARY`
`static byte` `OPCODE_CLOSE`
`static byte` `OPCODE_CONT`
`static byte` `OPCODE_PING`
`static byte` `OPCODE_PONG`
`static byte` `OPCODE_TEXT`

### Constructor Summary

Constructors
Constructor and Description
`WebSocketConnectionImpl(NioWriter writer, byte[] maskingBytes, org.jetlang.fibers.NioFiber readFiber, HttpRequest request)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `add(org.jetlang.core.Disposable disposable)`
`void` `close()` Attempts to close the underlying socket.
`void` `dispose()`
`void` `execute(Runnable command)`
`static org.jetlang.web.WebSocketConnectionImpl.SizeType` `findSize(int length)`
`SocketAddress` `getRemoteAddress()`
`HttpRequest` `getRequest()`
`boolean` `remove(org.jetlang.core.Disposable disposable)`
`org.jetlang.core.Disposable` `schedule(Runnable runnable, long l, TimeUnit timeUnit)`
`org.jetlang.core.Disposable` `scheduleAtFixedRate(Runnable runnable, long initialDelay, long delay, TimeUnit timeUnit)`
`org.jetlang.core.Disposable` `scheduleWithFixedDelay(Runnable runnable, long initialDelay, long delay, TimeUnit timeUnit)`
`SendResult` `send(String msg)` Non-Blocking send of a text message.
`SendResult` `sendBinary(byte[] buffer, int offset, int length)` Non-Blocking send of a binary message.
`SendResult` `sendPing(byte[] bytes, int offset, int length)` Non-Blocking send
`SendResult` `sendPong(byte[] bytes, int offset, int length)` Non-Blocking send
`int` `size()`

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

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

### Field Detail

#### OPCODE_CONT

    public static final byte OPCODE_CONT

See Also:
  Constant Field Values

#### OPCODE_TEXT

    public static final byte OPCODE_TEXT

See Also:
  Constant Field Values

#### OPCODE_BINARY

    public static final byte OPCODE_BINARY

See Also:
  Constant Field Values

#### OPCODE_CLOSE

    public static final byte OPCODE_CLOSE

See Also:
  Constant Field Values

#### OPCODE_PING

    public static final byte OPCODE_PING

See Also:
  Constant Field Values

#### OPCODE_PONG

    public static final byte OPCODE_PONG

See Also:
  Constant Field Values

#### empty

    public static final byte[] empty

### Constructor Detail

#### WebSocketConnectionImpl

    public WebSocketConnectionImpl(NioWriter writer,
                                   byte[] maskingBytes,
                                   org.jetlang.fibers.NioFiber readFiber,
                                   HttpRequest request)

### Method Detail

#### getRequest

    public HttpRequest getRequest()

Specified by:
  `getRequest` in interface `WebSocketConnection`

#### getRemoteAddress

    public SocketAddress getRemoteAddress()

Specified by:
  `getRemoteAddress` in interface `WebSocketConnection`
Returns:
  the remote address or null if it can't be resolved.

#### send

    public SendResult send(String msg)

Description copied from interface: `WebSocketConnection`
Non-Blocking send of a text message.

Specified by:
  `send` in interface `WebSocketConnection`

#### sendPong

    public SendResult sendPong(byte[] bytes,
                               int offset,
                               int length)

Description copied from interface: `WebSocketConnection`
Non-Blocking send

Specified by:
  `sendPong` in interface `WebSocketConnection`

#### sendPing

    public SendResult sendPing(byte[] bytes,
                               int offset,
                               int length)

Description copied from interface: `WebSocketConnection`
Non-Blocking send

Specified by:
  `sendPing` in interface `WebSocketConnection`

#### sendBinary

    public SendResult sendBinary(byte[] buffer,
                                 int offset,
                                 int length)

Description copied from interface: `WebSocketConnection`
Non-Blocking send of a binary message.

Specified by:
  `sendBinary` in interface `WebSocketConnection`

#### findSize

    public static org.jetlang.web.WebSocketConnectionImpl.SizeType findSize(int length)

#### close

    public void close()

Description copied from interface: `WebSocketConnection`
Attempts to close the underlying socket.

Specified by:
  `close` in interface `WebSocketConnection`

#### schedule

    public org.jetlang.core.Disposable schedule(Runnable runnable,
                                                long l,
                                                TimeUnit timeUnit)

Specified by:
  `schedule` in interface `org.jetlang.core.Scheduler`

#### scheduleWithFixedDelay

    public org.jetlang.core.Disposable scheduleWithFixedDelay(Runnable runnable,
                                                              long initialDelay,
                                                              long delay,
                                                              TimeUnit timeUnit)

Specified by:
  `scheduleWithFixedDelay` in interface `org.jetlang.core.Scheduler`

#### scheduleAtFixedRate

    public org.jetlang.core.Disposable scheduleAtFixedRate(Runnable runnable,
                                                           long initialDelay,
                                                           long delay,
                                                           TimeUnit timeUnit)

Specified by:
  `scheduleAtFixedRate` in interface `org.jetlang.core.Scheduler`

#### add

    public void add(org.jetlang.core.Disposable disposable)

Specified by:
  `add` in interface `org.jetlang.core.DisposingExecutor`

#### remove

    public boolean remove(org.jetlang.core.Disposable disposable)

Specified by:
  `remove` in interface `org.jetlang.core.DisposingExecutor`

#### size

    public int size()

Specified by:
  `size` in interface `org.jetlang.core.DisposingExecutor`

#### execute

    public void execute(Runnable command)

Specified by:
  `execute` in interface `Executor`

#### dispose

    public void dispose()

Specified by:
  `dispose` in interface `org.jetlang.core.Disposable`