Notification Events Overview¶
The Strix Unity SDK has multiple events you can subscribe to. Some of these events (though not all) provide useful information such as additional details of the event or error codes, too.
Also see Order of Events for interaction between multiple events.
Room events¶
(All available on StrixNetwork.instance.roomSession.roomClient
.)
Responses to network actions by the current client
RoomCreated
Fired on the creation of the room.
RoomJoined
Fired on joining the room.
RoomLeft
Fired on leaving the room.
Responses to network actions by the current client or by another client
RoomSet
Fired on the modification of the room properties by the current client or others
RoomDeleted
Fired on room deletion by the current client or others
Events that originate from actions performed on other clients or the server
RoomJoinNotified
Fired when a new room member joins the room.
RoomLeaveNotified
Fired when some room member of a room leaves it.
RoomDeleteNotified
Fired when the room gets deleted.
RoomSetNotified
Fired when the room owner modifies the room properties.
RoomSetMemberNotified
Fired when a member of a room modifies their properties.
RoomDirectRelayNotified
Fired when you receive a direct relay message.
RoomRelayNotified
Fired when you receive a broadcast relay message.
MatchRoomKickNotified
Fired when a member of the room gets kicked out of the room.
RoomOwnerChanged
Fired when the room ownership is transferred.
Note
A handler of RoomJoinNotified event receives an argument with a member named Data, and its GetNewlyJoinedMember method provides an object that holds information about the joined member. The type of the information object is defined as SoftGear.Strix.Client.Room.Model.IRoomMember interface which has a few properties.
When using Strix Cloud, however, it is guaranteed that the object is an instance of SoftGear.Strix.Client.Match.Room.Model.MatchRoomMember class that implements IRoomMember. So, you can cast it to MatchRoomMember to get more information about the member, as in the code fragment below.
StrixNetwork.instance.roomSession.roomClient.RoomJoinNotified = e => Debug.Log(((MatchRoomMember)e.Data.GetNewlyJoinedMember()).GetName());
The same is true for other room events named Notified whose argument (indirectly) provides IRoomMember (such as RoomLeaveNotified event).
Replica events¶
(Available on StrixNetwork.instance.roomSession.replicaClient
.)
ReplicaCreateNotified |
Fired when a new replica is created. |
ReplicaSetNotified |
Fired when someone changes the properties of some replica. |
ReplicaDeleteNotified |
Fired when someone deletes a replica. |
ReplicaChangeOwnerNotified |
Fired when a replica gets a new owner. |
Session events¶
(Available both on StrixNetwork.instance.roomSession
and StrixNetwork.instance.masterSession
.)
Connected |
Called every time a new connection is established. |
ConnectFailed |
Called when a new connection attempt has been made but failed. |
Closed |
Called when an existing connection has been terminated. |
ErrorThrown |
Called when some error happens. Usually this is caused by a SocketException in the underlying .NET libraries or when the host address could not be resolved. |
Note
Session events on roomSession take care of the room server connection, and those on masterSession take care of the master server connection.