org.jetlang.remote.acceptor

## Class JetlangStreamSession

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

All Implemented Interfaces:
  JetlangMessagePublisher, JetlangSession, JetlangRemotingProtocol.Handler

    public class JetlangStreamSession
    extends JetlangBaseSession
    implements JetlangRemotingProtocol.Handler

### 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
`JetlangStreamSession(Object id, MessageStreamWriter socket, org.jetlang.fibers.Fiber sendFiber, ErrorHandler errorHandler)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `disconnect()` Attempts to disconnect the client.
`void` `onLogout()`
`void` `onRequestReply(int reqId, String dataTopicVal, Object readObject)`
`void` `onSubscriptionRequest(String topic)`
`void` `onUnknownMessage(int read)`
`void` `onUnsubscribeRequest(String top)`
`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` `startHeartbeat(int interval, TimeUnit unit)`

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

`getHeartbeatChannel, getLogoutChannel, getReadTimeoutChannel, getSessionCloseChannel, getSessionId, getSessionMessageChannel, getSessionRequestChannel, getSubscriptionRequestChannel, getUnsubscribeChannel, newChannel, onClose, 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.core.JetlangRemotingProtocol.Handler

`onHb, onMessage, onRequest`

### Constructor Detail

#### JetlangStreamSession

    public JetlangStreamSession(Object id,
                                MessageStreamWriter socket,
                                org.jetlang.fibers.Fiber sendFiber,
                                ErrorHandler errorHandler)

### Method Detail

#### startHeartbeat

    public void startHeartbeat(int interval,
                               TimeUnit unit)

#### onSubscriptionRequest

    public void onSubscriptionRequest(String topic)

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

#### onUnsubscribeRequest

    public void onUnsubscribeRequest(String top)

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

#### disconnect

    public void disconnect()

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

Specified by:
  `disconnect` in interface `JetlangSession`

#### onLogout

    public void onLogout()

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

#### onUnknownMessage

    public void onUnknownMessage(int read)

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

#### publish

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

Specified by:
  `publish` in interface `JetlangMessagePublisher`
Specified by:
  `publish` 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`