fm.liveswitch.DataChannelBase< TDataChannel > Class Template Referenceabstract

Data channel base properties/methods. More...

Public Member Functions

void addOnStateChange (fm.liveswitch.IAction1< TDataChannel > value)
 Adds a handler that is raised when the data channel state changes. More...
 
long getBytesReceived ()
 Gets the number of bytes received. More...
 
long getBytesSent ()
 Gets the number of bytes sent. More...
 
String getConnectionId ()
 Gets the connection identifier. More...
 
String getId ()
 Gets the identifier. More...
 
fm.liveswitch.DataChannelInfo getInfo ()
 Gets the data channel info. More...
 
boolean getIsInternal ()
 Gets a value indicating if this is an internal data channel. More...
 
boolean getIsTerminated ()
 Gets a value indicating whether the data channel is currently closed or failed. More...
 
boolean getIsTerminating ()
 Gets a value indicating whether the data channel is currently closing. More...
 
boolean getIsTerminatingOrTerminated ()
 Gets a value indicating whether the data channel is currently closing, closed, or failed. More...
 
String getLabel ()
 Gets the label. More...
 
long getMessagesReceived ()
 Gets the number of messages received. More...
 
long getMessagesSent ()
 Gets the number of messages sent. More...
 
fm.liveswitch.IAction1< fm.liveswitch.DataChannelReceiveArgsgetOnReceive ()
 Gets a callback invoked when a message is received. More...
 
boolean getOrdered ()
 Gets a value indicating whether messages will be delivered in the order they are sent. More...
 
fm.liveswitch.DataChannelState getState ()
 Gets the state. More...
 
String getStreamId ()
 Gets the stream identifier. More...
 
String getSubprotocol ()
 Gets the subprotocol. More...
 
void removeOnStateChange (fm.liveswitch.IAction1< TDataChannel > value)
 Removes a handler that is raised when the data channel state changes. More...
 
abstract fm.liveswitch.Future< Object > sendDataBytes (fm.liveswitch.DataBuffer dataBytes)
 Sends some bytes. More...
 
abstract fm.liveswitch.Future< Object > sendDataString (String dataString)
 Sends a string. More...
 
void setOnReceive (fm.liveswitch.IAction1< fm.liveswitch.DataChannelReceiveArgs > value)
 Sets a callback invoked when a message is received. More...
 
- Public Member Functions inherited from fm.liveswitch.Dynamic
java.util.HashMap< String, Object > getDynamicProperties ()
 Gets all dynamic properties on this instance. More...
 
Object getDynamicValue (String key)
 Gets a property value from the local cache. More...
 
void setDynamicValue (String key, Object value)
 Sets a property value in the local cache. More...
 
boolean unsetDynamicValue (String key)
 Removes a property value from the local cache. More...
 

Protected Member Functions

 DataChannelBase (String label, boolean ordered, String subprotocol)
 Initializes a new instance of the fm.liveswitch.DataChannelBase class. More...
 
 DataChannelBase (String label, boolean ordered, String subprotocol, boolean internalChannel)
 Initializes a new instance of the fm.liveswitch.DataChannelBase class. More...
 
abstract TDataChannel getInstance ()
 Gets the current instance. More...
 
void processStateChange ()
 Processes a state change. More...
 
void processStateLockChange ()
 Processes a state lock change. More...
 
void raiseDataBytes (fm.liveswitch.DataBuffer dataBytes)
 Raises the OnReceive callback with data bytes. More...
 
void raiseDataString (String dataString)
 Raises the OnReceive callback with a data string. More...
 
void registerDataReceived (int dataLength)
 Registers that a data has been sent. More...
 
void registerDataSent (int dataLength)
 Registers that a data has been sent. More...
 
- Protected Member Functions inherited from fm.liveswitch.Dynamic
 Dynamic ()
 
- Protected Member Functions inherited from fm.liveswitch.Serializable
boolean getIsDirty ()
 Gets a value indicating whether this instance is dirty. More...
 
 Serializable ()
 Initializes a new instance of the fm.liveswitch.Serializable class. More...
 
void setIsDirty (boolean value)
 Sets a value indicating whether this instance is dirty. More...
 

Detailed Description

Data channel base properties/methods.

Constructor & Destructor Documentation

◆ DataChannelBase() [1/2]

fm.liveswitch.DataChannelBase< TDataChannel >.DataChannelBase ( String  label,
boolean  ordered,
String  subprotocol 
)
protected

Initializes a new instance of the fm.liveswitch.DataChannelBase class.

Parameters
labelThe label.
orderedWhether messages will be delivered in the order they are sent.
subprotocolThe subprotocol.

◆ DataChannelBase() [2/2]

fm.liveswitch.DataChannelBase< TDataChannel >.DataChannelBase ( String  label,
boolean  ordered,
String  subprotocol,
boolean  internalChannel 
)
protected

Initializes a new instance of the fm.liveswitch.DataChannelBase class.

Parameters
labelThe label.
orderedWhether messages will be delivered in the order they are sent.
subprotocolThe subprotocol.
internalChannelIndicates whether this is an internal channel.

Member Function Documentation

◆ addOnStateChange()

void fm.liveswitch.DataChannelBase< TDataChannel >.addOnStateChange ( fm.liveswitch.IAction1< TDataChannel >  value)

Adds a handler that is raised when the data channel state changes.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getBytesReceived()

long fm.liveswitch.DataChannelBase< TDataChannel >.getBytesReceived ( )

Gets the number of bytes received.

◆ getBytesSent()

long fm.liveswitch.DataChannelBase< TDataChannel >.getBytesSent ( )

Gets the number of bytes sent.

◆ getConnectionId()

String fm.liveswitch.DataChannelBase< TDataChannel >.getConnectionId ( )

Gets the connection identifier.

◆ getId()

String fm.liveswitch.DataChannelBase< TDataChannel >.getId ( )

Gets the identifier.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getInfo()

Gets the data channel info.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getInstance()

abstract TDataChannel fm.liveswitch.DataChannelBase< TDataChannel >.getInstance ( )
abstractprotected

Gets the current instance.

◆ getIsInternal()

boolean fm.liveswitch.DataChannelBase< TDataChannel >.getIsInternal ( )

Gets a value indicating if this is an internal data channel.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getIsTerminated()

boolean fm.liveswitch.DataChannelBase< TDataChannel >.getIsTerminated ( )

Gets a value indicating whether the data channel is currently closed or failed.

◆ getIsTerminating()

boolean fm.liveswitch.DataChannelBase< TDataChannel >.getIsTerminating ( )

Gets a value indicating whether the data channel is currently closing.

◆ getIsTerminatingOrTerminated()

boolean fm.liveswitch.DataChannelBase< TDataChannel >.getIsTerminatingOrTerminated ( )

Gets a value indicating whether the data channel is currently closing, closed, or failed.

◆ getLabel()

String fm.liveswitch.DataChannelBase< TDataChannel >.getLabel ( )

Gets the label.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getMessagesReceived()

long fm.liveswitch.DataChannelBase< TDataChannel >.getMessagesReceived ( )

Gets the number of messages received.

◆ getMessagesSent()

long fm.liveswitch.DataChannelBase< TDataChannel >.getMessagesSent ( )

Gets the number of messages sent.

◆ getOnReceive()

Gets a callback invoked when a message is received.

Example:

channel.addOnReceive(new IAction1<DataChannelArgs>() {
@Override
public void invoke(DataChannelArgs args) {
...
}
});

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getOrdered()

boolean fm.liveswitch.DataChannelBase< TDataChannel >.getOrdered ( )

Gets a value indicating whether messages will be delivered in the order they are sent.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ getState()

◆ getStreamId()

String fm.liveswitch.DataChannelBase< TDataChannel >.getStreamId ( )

Gets the stream identifier.

◆ getSubprotocol()

String fm.liveswitch.DataChannelBase< TDataChannel >.getSubprotocol ( )

Gets the subprotocol.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ processStateChange()

void fm.liveswitch.DataChannelBase< TDataChannel >.processStateChange ( )
protected

Processes a state change.

◆ processStateLockChange()

void fm.liveswitch.DataChannelBase< TDataChannel >.processStateLockChange ( )
protected

Processes a state lock change.

◆ raiseDataBytes()

void fm.liveswitch.DataChannelBase< TDataChannel >.raiseDataBytes ( fm.liveswitch.DataBuffer  dataBytes)
protected

Raises the OnReceive callback with data bytes.

Parameters
dataBytesThe data bytes.

◆ raiseDataString()

void fm.liveswitch.DataChannelBase< TDataChannel >.raiseDataString ( String  dataString)
protected

Raises the OnReceive callback with a data string.

Parameters
dataStringThe data string.

◆ registerDataReceived()

void fm.liveswitch.DataChannelBase< TDataChannel >.registerDataReceived ( int  dataLength)
protected

Registers that a data has been sent.

Parameters
dataLengthThe data length.

◆ registerDataSent()

void fm.liveswitch.DataChannelBase< TDataChannel >.registerDataSent ( int  dataLength)
protected

Registers that a data has been sent.

Parameters
dataLengthThe data length.

◆ removeOnStateChange()

void fm.liveswitch.DataChannelBase< TDataChannel >.removeOnStateChange ( fm.liveswitch.IAction1< TDataChannel >  value)

Removes a handler that is raised when the data channel state changes.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ sendDataBytes()

abstract fm.liveswitch.Future<Object> fm.liveswitch.DataChannelBase< TDataChannel >.sendDataBytes ( fm.liveswitch.DataBuffer  dataBytes)
abstract

Sends some bytes.

Parameters
dataBytesThe data bytes.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ sendDataString()

abstract fm.liveswitch.Future<Object> fm.liveswitch.DataChannelBase< TDataChannel >.sendDataString ( String  dataString)
abstract

Sends a string.

Parameters
dataStringThe data string.

Implements fm.liveswitch.IDataChannel< TDataChannel >.

◆ setOnReceive()

Sets a callback invoked when a message is received.

Example:

channel.addOnReceive(new IAction1<DataChannelArgs>() {
@Override
public void invoke(DataChannelArgs args) {
...
}
});

Implements fm.liveswitch.IDataChannel< TDataChannel >.