Replies to an invitation received by the current user.

Namespace: Sfs2X.Requests.Game
Assembly: SmartFox2X (in SmartFox2X.dll) Version: (1.7.3)


public class InvitationReplyRequest : BaseRequest


Users who receive an invitation sent by means of the InviteUsersRequest request can either accept or refuse it using this request. The reply causes an INVITATION_REPLY event to be dispatched to the inviter; if a reply is not sent, or it is sent after the invitation expiration, the system will react as if the invitation was refused.

If an error occurs while the reply is delivered to the inviter user (for example the invitation is already expired), an INVITATION_REPLY_ERROR event is returned to the current user.


The following example receives an invitation and accepts it automatically; in a real case scenario, the application interface usually allows the user choosing to accept or refuse the invitation, or even ignore it:
 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.INVITATION, OnInvitationReceived);
    sfs.AddEventListener(SFSEvent.INVITATION_REPLY_ERROR, OnInvitationReplyError);
void OnInvitationReceived(BaseEvent evt) {
    // Let's accept this invitation
    sfs.Send( new InvitationReplyRequest((Invitation)evt.Params["invitation"], InvitationReply.ACCEPT) );
void OnInvitationReplyError(BaseEvent evt) {
    Console.WriteLine("Failed to reply to invitation due to the following problem: " + (string)evt.Params["errorMessage"]);                         // .Net / Unity
    System.Diagnostics.Debug.WriteLine("Failed to reply to invitation due to the following problem: " + (string)evt.Params["errorMessage"]);        // Windows Universal

Inheritance Hierarchy


See Also