org.jetlang.remote.acceptor

## Class JetlangNioSession

- java.lang.Object
- - org.jetlang.remote.acceptor.JetlangBaseSession
  - - org.jetlang.remote.acceptor.JetlangNioSession

All Implemented Interfaces:
  JetlangMessageHandler, JetlangMessagePublisher, JetlangSession, JetlangRemotingProtocol.Handler

    public class JetlangNioSession
    extends JetlangBaseSession
    implements JetlangMessageHandler

### Nested Class Summary

Nested Classes
`static interface` `JetlangNioSession.ErrorHandler`

### Field Summary

### Fields inherited from class org.jetlang.remote.acceptor.JetlangBaseSession

`Heartbeat, id, Logout, Messages, ReadTimeout, SessionClose, SessionRequest, SubscriptionRequest, UnsubscribeRequest`

### Constructor Summary

Constructors
Constructor and Description
`JetlangNioSession(org.jetlang.fibers.NioFiber fiber, SocketChannel channel, NioJetlangSendFiber sendFiber, NioJetlangRemotingClientFactory.Id id, JetlangNioSession.ErrorHandler errorHandler)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `disconnect()` Attempts to disconnect the client.
`void` `onClose(SessionCloseEvent sessionCloseEvent)`
`void` `onLogout()`
`void` `onRequestReply(int reqId, String dataTopicVal, Object readObject)`
`void` `onSubscriptionRequest(String topic)`
`void` `onUnknownMessage(int read)`
`void` `onUnsubscribeRequest(String topic)`
`void` `publish(byte[] data)` publish raw bytes.
`<T> void` `publish(String topic, T msg)`
`void` `publishIfSubscribed(String topic, byte[] data)`
`void` `reply(int reqId, String replyTopic, Object replyMsg)`
`void` `sendHb()`

### Methods inherited from class org.jetlang.remote.acceptor.JetlangBaseSession

`getHeartbeatChannel, getLogoutChannel, getReadTimeoutChannel, getSessionCloseChannel, getSessionId, getSessionMessageChannel, getSessionRequestChannel, getSubscriptionRequestChannel, getUnsubscribeChannel, newChannel, onHb, onMessage, onReadTimeout, onRequest`

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

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

### Methods inherited from interface org.jetlang.remote.acceptor.JetlangMessageHandler

`getSessionId, onReadTimeout`

### Methods inherited from interface org.jetlang.remote.core.JetlangRemotingProtocol.Handler

`onHb, onMessage, onRequest`

### Constructor Detail

#### JetlangNioSession

    public JetlangNioSession(org.jetlang.fibers.NioFiber fiber,
                             SocketChannel channel,
                             NioJetlangSendFiber sendFiber,
                             NioJetlangRemotingClientFactory.Id id,
                             JetlangNioSession.ErrorHandler errorHandler)

### Method Detail

#### sendHb

    public void sendHb()

#### onLogout

    public void onLogout()

Specified by:
  `onLogout` in interface `JetlangRemotingProtocol.Handler`
Specified by:
  `onLogout` in class `JetlangBaseSession`

#### onSubscriptionRequest

    public void onSubscriptionRequest(String topic)

Specified by:
  `onSubscriptionRequest` in interface `JetlangRemotingProtocol.Handler`
Specified by:
  `onSubscriptionRequest` in class `JetlangBaseSession`

#### onUnsubscribeRequest

    public void onUnsubscribeRequest(String topic)

Specified by:
  `onUnsubscribeRequest` in interface `JetlangRemotingProtocol.Handler`
Specified by:
  `onUnsubscribeRequest` in class `JetlangBaseSession`

#### publish

    public <T> void publish(String topic,
                            T msg)

Specified by:
  `publish` in interface `JetlangMessagePublisher`
Specified by:
  `publish` in interface `JetlangSession`

#### disconnect

    public void disconnect()

Description copied from interface: `JetlangSession`
Attempts to disconnect the client.

Specified by:
  `disconnect` in interface `JetlangSession`

#### publish

    public void publish(byte[] data)

Description copied from interface: `JetlangSession`
publish raw bytes. The bytes should be correctly formatted with the topic included. The bytes will be published asynchronously, so the byte array should be a thread safe copy of the data.

Specified by:
  `publish` in interface `JetlangSession`
Specified by:
  `publish` in class `JetlangBaseSession`

#### reply

    public void reply(int reqId,
                      String replyTopic,
                      Object replyMsg)

Specified by:
  `reply` in interface `JetlangMessagePublisher`
Specified by:
  `reply` in class `JetlangBaseSession`

#### onRequestReply

    public void onRequestReply(int reqId,
                               String dataTopicVal,
                               Object readObject)

Specified by:
  `onRequestReply` in interface `JetlangRemotingProtocol.Handler`

#### publishIfSubscribed

    public void publishIfSubscribed(String topic,
                                    byte[] data)

Specified by:
  `publishIfSubscribed` in class `JetlangBaseSession`

#### onClose

    public void onClose(SessionCloseEvent sessionCloseEvent)

Overrides:
  `onClose` in class `JetlangBaseSession`

#### onUnknownMessage

    public void onUnknownMessage(int read)

Specified by:
  `onUnknownMessage` in interface `JetlangRemotingProtocol.Handler`