Class DataChannelBase<TDataChannel>
Data channel base properties/methods.
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class DataChannelBase<TDataChannel> : Dynamic, IDataChannel<TDataChannel>
Type Parameters
Name | Description |
---|---|
TDataChannel |
Constructors
DataChannelBase(String, Boolean, String)
Initializes a new instance of the DataChannelBase<TDataChannel> class.
Declaration
protected DataChannelBase(string label, bool ordered, string subprotocol)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The label. |
System.Boolean | ordered | Whether messages will be delivered in the order they are sent. |
System.String | subprotocol | The subprotocol. |
DataChannelBase(String, Boolean, String, Boolean)
Initializes a new instance of the DataChannelBase<TDataChannel> class.
Declaration
protected DataChannelBase(string label, bool ordered, string subprotocol, bool internalChannel)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The label. |
System.Boolean | ordered | Whether messages will be delivered in the order they are sent. |
System.String | subprotocol | The subprotocol. |
System.Boolean | internalChannel | Indicates whether this is an internal channel. |
Properties
BytesReceived
Gets the number of bytes received.
Declaration
public long BytesReceived { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
BytesSent
Gets the number of bytes sent.
Declaration
public long BytesSent { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ConnectionId
Gets the connection identifier.
Declaration
public string ConnectionId { get; }
Property Value
Type | Description |
---|---|
System.String |
Id
Gets the identifier.
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
Info
Gets the data channel info.
Declaration
public DataChannelInfo Info { get; }
Property Value
Type | Description |
---|---|
DataChannelInfo |
Instance
Gets the current instance.
Declaration
protected abstract TDataChannel Instance { get; }
Property Value
Type | Description |
---|---|
TDataChannel |
IsInternal
Gets a value indicating if this is an internal data channel.
Declaration
public bool IsInternal { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminated
Gets a value indicating whether the data channel is currently closed or failed.
Declaration
public bool IsTerminated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminating
Gets a value indicating whether the data channel is currently closing.
Declaration
public bool IsTerminating { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminatingOrTerminated
Gets a value indicating whether the data channel is currently closing, closed, or failed.
Declaration
public bool IsTerminatingOrTerminated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
Gets the label.
Declaration
public string Label { get; }
Property Value
Type | Description |
---|---|
System.String |
MessagesReceived
Gets the number of messages received.
Declaration
public long MessagesReceived { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
MessagesSent
Gets the number of messages sent.
Declaration
public long MessagesSent { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
OnReceive
Gets or sets a callback invoked when a message is received.
Declaration
public Action1<DataChannelReceiveArgs> OnReceive { get; set; }
Property Value
Type | Description |
---|---|
Action1<DataChannelReceiveArgs> |
Ordered
Gets a value indicating whether messages will be delivered in the order they are sent.
Declaration
public bool Ordered { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
State
Gets or sets the state.
Declaration
public DataChannelState State { get; }
Property Value
Type | Description |
---|---|
DataChannelState |
StreamId
Gets the stream identifier.
Declaration
public string StreamId { get; }
Property Value
Type | Description |
---|---|
System.String |
Subprotocol
Gets the subprotocol.
Declaration
public string Subprotocol { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
ProcessStateChange()
Processes a state change.
Declaration
protected virtual void ProcessStateChange()
ProcessStateLockChange()
Processes a state lock change.
Declaration
protected virtual void ProcessStateLockChange()
RaiseDataBytes(DataBuffer)
Raises the OnReceive callback with data bytes.
Declaration
protected void RaiseDataBytes(DataBuffer dataBytes)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | dataBytes | The data bytes. |
RaiseDataString(String)
Raises the OnReceive callback with a data string.
Declaration
protected void RaiseDataString(string dataString)
Parameters
Type | Name | Description |
---|---|---|
System.String | dataString | The data string. |
RegisterDataReceived(Int32)
Registers that a data has been sent.
Declaration
protected void RegisterDataReceived(int dataLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The data length. |
RegisterDataSent(Int32)
Registers that a data has been sent.
Declaration
protected void RegisterDataSent(int dataLength)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataLength | The data length. |
SendDataBytes(DataBuffer)
Sends some bytes.
Declaration
public abstract Future<object> SendDataBytes(DataBuffer dataBytes)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | dataBytes | The data bytes. |
Returns
Type | Description |
---|---|
Future<System.Object> |
SendDataString(String)
Sends a string.
Declaration
public abstract Future<object> SendDataString(string dataString)
Parameters
Type | Name | Description |
---|---|---|
System.String | dataString | The data string. |
Returns
Type | Description |
---|---|
Future<System.Object> |
Events
OnStateChange
Raised when the data channel state changes.
Declaration
public event Action1<TDataChannel> OnStateChange
Event Type
Type | Description |
---|---|
Action1<TDataChannel> |