|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Sends a generic invitation to a list of users. More...
#include <InviteUsersRequest.h>
Public Member Functions | |
| InviteUsersRequest (std::vector< Invitee > invitedUsers, int32_t secondsForAnswer, std::shared_ptr< entities::SFSObject > params=nullptr) | |
| Creates a new InviteUsersRequest. | |
Sends a generic invitation to a list of users.
Invitations can be used for different purposes, such as requesting users to join a game or visit a specific Room, asking the permission to add them as buddies, etc. Invited users receive the invitation as an event::SFSEvent::INVITATION event dispatched to their clients: they can accept or refuse it by means of the InvitationReplyRequest request, which must be sent within the specified amount of time.
Each reply comes back to the inviter as an event::SFSEvent::INVITATION_REPLY event, one per invited user; the invitations that are left unanswered produce one too, carrying an EXPIRED reply, as soon as the time given to answer runs out.
What an accepted invitation does is entirely up to the developer: the server takes no action of its own. The one exception is JoinRoomInvitationRequest, which builds on the same mechanism to join the invitee in a Room.
auto params = std::make_shared<entities::SFSObject>(); params->putShortString("msg", "Come and play with us!"); std::vector<requests::Invitee> invitees { user1, user2 }; sfs.send(requests::inv::InviteUsersRequest(std::move(invitees), 20, params));
|
inline |
Creates a new InviteUsersRequest.
Pass it to SmartFox::send for the request to be performed.
| invitedUsers | the users to send the invitation to; no more than MAX_INVITATIONS_FROM_CLIENT_SIDE. The current user is skipped if listed: nobody can invite himself |
| secondsForAnswer | the number of seconds available to each invited user to reply to the invitation (recommended range: 15 to 40 seconds) |
| params | the custom parameters describing the invitation, such as a message for the recipient; optional |