![]() |
Diarkis C# Client SDK
|
Public Member Functions | |
bool | Setup (Ws ws) |
Sets up the instance of as a Ws client. More... | |
override void | Destroy () |
Destroy all setup listeners and other internal properties. You will need to call SetupAs... to reuse the instance. More... | |
override void | Create (bool allowEmpty, bool join, ushort ttl) |
Creates a new group. More... | |
override void | Join (string groupID, byte[] message) |
Joins a group. A client can join multiple groups at a time. More... | |
override 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. The group will be available for 60 seconds for random join. More... | |
override void | Leave (string groupID, byte[] message) |
Leaves the group the client has joined. More... | |
override void | BroadcastTo (string groupID, byte[] message, bool reliable=true) |
Sends a message to all members of the group. More... | |
![]() | |
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... | |
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... | |
void | OnCustomBroadcast (uint ver, uint cmd, Action< byte[]> callback) |
Registers a callback on custom broadcast by ver and cmd More... | |
Events | |
override CreateHandler | OnCreate |
override ResponseHandler | OnJoin |
override ResponseHandler | OnLeave |
override MessageHandler | OnMemberJoin |
override MessageHandler | OnMemberLeave |
override MessageHandler | OnMemberBroadcast |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
List< string > | _groupIDs |
string | _lastErrMessage = "" |
![]() | |
const uint | BUILTIN_CMD_VER = 1 |
const uint | CREATE_CMD = 110 |
const uint | JOIN_CMD = 111 |
const uint | LEAVE_CMD = 112 |
const uint | BROADCAST_CMD = 113 |
const uint | STATUS_OK = 1 |
const uint | RAND_JOIN_CMD = 114 |
|
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 from Diarkis.Modules.Group.
|
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 from Diarkis.Modules.Group.
|
inlinevirtual |
Destroy all setup listeners and other internal properties. You will need to call SetupAs... to reuse the instance.
Reimplemented from Diarkis.Modules.Group.
|
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 from Diarkis.Modules.Group.
|
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. The group will be available for 60 seconds for random join.
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. |
interval | Broadcast push interval in milliseconds. Default is 200ms. If 0 is given, broadcast packets will not be merged. |
Reimplemented from Diarkis.Modules.Group.
|
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 from Diarkis.Modules.Group.
|
inline |
Sets up the instance of as a Ws client.
ws | An instance of Ws |