|
WebRTC Video Chat 1.1.4
|
Contains information about events received by the network. More...
Public Member Functions | |
| byte[] | GetDataAsByteArray () |
| Returns the a copy of the message data as a new byte array with the exact size of the content instead of the buffer. | |
| NetworkEvent (NetEventType t) | |
| Creates a new network event of a certain type setting connection id to invalid and data to null. | |
| NetworkEvent (NetEventType t, ConnectionId conId) | |
| Events without data connected. | |
| NetworkEvent (NetEventType t, ConnectionId conId, MessageDataBuffer dt) | |
| Creates a network event with the given content Internal only. Do not use. | |
| NetworkEvent (NetEventType t, ConnectionId conId, object dt) | |
| Old constructor. | |
| NetworkEvent (NetEventType t, ConnectionId conId, string address) | |
| ServerInit events with address info. | |
| NetworkEvent (NetEventType t, ConnectionId conId, ErrorInfo errorInfo) | |
| Network event with ErrorInfo attached. ErrorInfo can't be serialized yet! | |
| override string | ToString () |
| Converts the event to string. Use for debugging only. | |
| void | AttachError (ErrorInfo error) |
| Internal use only. Used to attach additional error information. | |
Static Public Member Functions | |
| static bool | IsMetaEvent (byte[] arr) |
| Checks if this is a special event that isn't suppose to be processed as NetworkEvent. Special events are null, empty byte[0] and any values starting with a byte equal or above NetEventType.ReservedStart;. | |
| static NetworkEvent | FromByteArray (byte[] arr) |
| Reverse of ToByteArray. | |
| static byte[] | ToByteArray (NetworkEvent evt) |
| Mainly used by WebsocketNetwork. It serializes network events into a byte array to allow to process the events on a different system than where it actually occurred. | |
Properties | |
| NetEventType | Type [get] |
| Returns the type of the message. | |
| ConnectionId | ConnectionId [get] |
| Returns the related connection id or ConnecitonId.Invalid if there is none. | |
| object | RawData [get] |
| Returns an object belonging to the event. This can be a MessageDataBuffer containing a byte array or a string or an errorinfo object. | |
| MessageDataBuffer | MessageData [get] |
| Returns the content of the messages if the event type is UnreliableMessageReceived or ReliableMessageReceived. | |
| string | Info [get] |
| Contains additional information or null Only used so far for NetEventType.ServerInitialized to return the servers address information. | |
| ErrorInfo | ErrorInfo [get] |
| Returns an error info object if one is connected. | |
Contains information about events received by the network.
The type of the network event decides the content it can contain.
Most important are:
UnreliableMessageReceived / ReliableMessageReceived: A new message was received. The property MessageData will return a buffer + byte array containing the data received.
ServerInitialized: A call to StartServer was successful. The Info property will return the address the server can be accessed by.
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t | ) |
Creates a new network event of a certain type setting connection id to invalid and data to null.
Internal only. Do not use.
| t | The type of this event |
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t, |
| ConnectionId | conId ) |
Events without data connected.
| t | |
| conId |
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t, |
| ConnectionId | conId, | ||
| MessageDataBuffer | dt ) |
Creates a network event with the given content Internal only. Do not use.
| t | Type name |
| conId | ConnectionId the event is from / relates to |
| dt | MessageDataBuffer (should be ByteArrayBuffer) |
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t, |
| ConnectionId | conId, | ||
| object | dt ) |
Old constructor.
| t | |
| conId | |
| dt |
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t, |
| ConnectionId | conId, | ||
| string | address ) |
ServerInit events with address info.
| t | |
| conId | |
| address |
| Byn.Awrtc.NetworkEvent.NetworkEvent | ( | NetEventType | t, |
| ConnectionId | conId, | ||
| ErrorInfo | errorInfo ) |
| void Byn.Awrtc.NetworkEvent.AttachError | ( | ErrorInfo | error | ) |
Internal use only. Used to attach additional error information.
| error |
|
static |
Reverse of ToByteArray.
| arr |
| byte[] Byn.Awrtc.NetworkEvent.GetDataAsByteArray | ( | ) |
Returns the a copy of the message data as a new byte array with the exact size of the content instead of the buffer.
|
static |
Checks if this is a special event that isn't suppose to be processed as NetworkEvent. Special events are null, empty byte[0] and any values starting with a byte equal or above NetEventType.ReservedStart;.
| arr |
true - means the message needs special handling and can't be passed to FromByteArray.
false - means the message can be a NetworkEvent but could still be invalid.
|
static |
Mainly used by WebsocketNetwork. It serializes network events into a byte array to allow to process the events on a different system than where it actually occurred.
e.g. WebsocketNetwork uses a server that will receive incoming connects and then serializes that event into a byte array and send it to the client which holds the address of the incoming connection to process the event
NOTE: This method is not optimized and shouldn't be used with a lot of data!
| evt | Network event to be serialized |
| override string Byn.Awrtc.NetworkEvent.ToString | ( | ) |
Converts the event to string. Use for debugging only.
|
get |
Returns the content of the messages if the event type is UnreliableMessageReceived or ReliableMessageReceived.
null for all other message types.