![]() |
Diarkis C# Client SDK
|
Public Member Functions | |
| delegate void | CreateHandler (bool success, string groupID, byte[] payload) |
| delegate void | ResponseHandler (bool success, string groupID, byte[] payload) |
| delegate void | MessageHandler (byte[] message) |
| bool | SetupAsTcp (Tcp tcp) |
| Sets up the instance of as a TCP client. More... | |
| bool | SetupAsUdp (Udp udp) |
| Sets up the instance of as a UDP client. More... | |
| bool | SetUdp (Tcp tcp) |
| Changes the TCP instance for the group. More... | |
| bool | SetUdp (Udp udp) |
| Changes the UDP instance for the group. More... | |
| virtual void | Destroy () |
| Destroy all setup listeners and other internal properties. You will need to call SetupAs... to reuse the instance. More... | |
| string | GetLastErrorMessage () |
| Returns a last error message of either Create, Join, JoinRandom, Leave etc. More... | |
| byte[] | GetLastErrorBytes () |
| Returns a last error message bytes of either Create, Join, JoinRandom, Leave etc. More... | |
| List< string > | GetGroupIDs () |
| Rerturns the list of group IDs that the client has joined. The returned list is a reference, please becareful with it. More... | |
| virtual void | Create (bool allowEmpty, bool join, ushort ttl) |
| Creates a new group. More... | |
| virtual void | Join (string groupID, byte[] message) |
| Joins a group. A client can join multiple groups at a time. More... | |
| virtual void | JoinRandom (ushort ttl, byte[] message, bool allowEmpty=false, uint interval=200) |
| Joins a random group if there is at least a group created by JoinRandom available. If not it will create a new group. If it does not find a group to join, it will instead create a new group. More... | |
| virtual void | Leave (string groupID, byte[] message) |
| Leaves the group the client has joined. More... | |
| virtual void | BroadcastTo (string groupID, byte[] message, bool reliable=true) |
| Sends a message to all members of the group. More... | |
| void | OnCustomBroadcast (uint ver, uint cmd, Action< byte[]> callback) |
| Registers a callback on custom broadcast by ver and cmd More... | |
Protected Attributes | |
| List< string > | _groupIDs |
| string | _lastErrMessage = "" |
Events | |
| virtual CreateHandler | OnCreate |
| The event raised as a server response of Create. More... | |
| virtual ResponseHandler | OnJoin |
| The event raised as a server response of Join. More... | |
| virtual ResponseHandler | OnLeave |
| The event raised as a server response of Leave. More... | |
| virtual MessageHandler | OnMemberJoin |
| The event is raised when a remote client joins the group. More... | |
| virtual MessageHandler | OnMemberLeave |
| The event is raised when a remote client leaves the group. More... | |
| virtual MessageHandler | OnMemberBroadcast |
| The event raised when a remote client sends a broadcast message via BroadcastTo. More... | |
Group allows clients to exchange packets freely within the same "group".
|
inlinevirtual |
Sends a message to all members of the group.
| groupID | Group ID of the group that the message will be sent to. |
| message | Message to be sent. |
| reliable | This parameter is only relevant for UDP. If true, the message will be delivered as an RUDP message. |
Reimplemented in Diarkis.Modules.WsGroup.
|
inlinevirtual |
Creates a new group.
| allowEmpty | If true, the group will not be destroyed immediately when it is empty of clients. |
| join | If true, the creator client of the group is automatically added to the group as a member. |
| ttl | TTL of the group when it is empty of members in seconds. |
Reimplemented in Diarkis.Modules.WsGroup.
|
inlinevirtual |
Destroy all setup listeners and other internal properties. You will need to call SetupAs... to reuse the instance.
Reimplemented in Diarkis.Modules.WsGroup.
|
inline |
Rerturns the list of group IDs that the client has joined. The returned list is a reference, please becareful with it.
|
inline |
Returns a last error message bytes of either Create, Join, JoinRandom, Leave etc.
|
inline |
Returns a last error message of either Create, Join, JoinRandom, Leave etc.
|
inlinevirtual |
Joins a group. A client can join multiple groups at a time.
| groupID | Group ID that the client will try to join. |
| message | Message that will be sent to the other members of the group when the client joins the group. |
Reimplemented in Diarkis.Modules.WsGroup.
|
inlinevirtual |
Joins a random group if there is at least a group created by JoinRandom available. If not it will create a new group. If it does not find a group to join, it will instead create a new group.
| ttl | TTL of the group when it is empty of members in seconds. |
| message | Message that will be sent to the other members of the group when the client joins the group. |
| allowEmpty | Allows the group created to stay avaialble when becomes empty until TTL runs out. |
| interval | Broadcast push interval in milliseconds. Default is 200ms. If 0 is given, broadcast packets will not be merged. |
Reimplemented in Diarkis.Modules.WsGroup.
|
inlinevirtual |
Leaves the group the client has joined.
| groupID | Group ID that the client will try to leave from. |
| message | Message that will be sent to the other members of the group when the client leaves the group. |
Reimplemented in Diarkis.Modules.WsGroup.
|
inline |
Registers a callback on custom broadcast by ver and cmd
| ver | Custom command version to listen to. |
| cmd | Custom command ID to listen to. |
| callback | Callback method to be invoked on targeted ver and cmd. |
|
inline |
Changes the TCP instance for the group.
| tcp | The new TCP instance. |
|
inline |
Changes the UDP instance for the group.
| udp | The new UDP instance. |
|
inline |
Sets up the instance of as a TCP client.
| tcp | An instance of Tcp |
|
inline |
Sets up the instance of as a UDP client.
| udp | An instance of Udp |
| virtual CreateHandler Diarkis.Modules.Group.OnCreate |
| virtual ResponseHandler Diarkis.Modules.Group.OnJoin |
| virtual ResponseHandler Diarkis.Modules.Group.OnLeave |
| virtual MessageHandler Diarkis.Modules.Group.OnMemberBroadcast |
The event raised when a remote client sends a broadcast message via BroadcastTo.
| message | A message byte array sent from the remote member client. |
| virtual MessageHandler Diarkis.Modules.Group.OnMemberJoin |
The event is raised when a remote client joins the group.
| message | A message byte array sent from the newly joined remote client. |
| virtual MessageHandler Diarkis.Modules.Group.OnMemberLeave |
The event is raised when a remote client leaves the group.
| message | A message byte array sent from the remote client that left the group. |
1.8.17