|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Joins the current user in a Room. More...
#include <JoinRoomRequest.h>
Public Member Functions | |
| JoinRoomRequest (int32_t roomId, std::optional< std::string > pass=std::nullopt, std::optional< int32_t > roomIdToLeave=std::nullopt, bool asSpect=false) | |
| Creates a new JoinRoomRequest for the Room with the given id. | |
| JoinRoomRequest (std::optional< std::string > name, std::optional< std::string > pass=std::nullopt, std::optional< int32_t > roomIdToLeave=std::nullopt, bool asSpect=false) | |
| Creates a new JoinRoomRequest for the Room with the given name. | |
| JoinRoomRequest (entities::Room *theRoom, std::optional< std::string > pass=std::nullopt, std::optional< int32_t > roomIdToLeave=std::nullopt, bool asSpect=false) | |
| Creates a new JoinRoomRequest for the given Room. | |
Joins the current user in a Room.
On success the current user receives a event::SFSEvent::ROOM_JOIN event, otherwise a event::SFSEvent::ROOM_JOIN_ERROR event. A join usually fails because the Room is full, or because the password is wrong for a Room that is protected by one.
Two more events can be fired, depending on the events setting the Room got at creation time: the other users inside the Room get a event::SFSEvent::USER_ENTER_ROOM event, and every client that subscribed the Group of the Room gets a event::SFSEvent::USER_COUNT_CHANGE event.
| sfs3::requests::JoinRoomRequest::JoinRoomRequest | ( | int32_t | roomId, |
| std::optional< std::string > | pass = std::nullopt, | ||
| std::optional< int32_t > | roomIdToLeave = std::nullopt, | ||
| bool | asSpect = false ) |
Creates a new JoinRoomRequest for the Room with the given id.
Pass it to SmartFox::send for the request to be performed.
| roomId | The id of the Room to join. |
| pass | The password of the Room, if it is protected by one. |
| roomIdToLeave | The id of a Room joined before, which the user leaves when it joins the new one. When it is empty the last joined Room is left; pass a negative number to leave no Room at all. |
| asSpect | true to join the Room as a spectator. Game Rooms only. |
| sfs3::requests::JoinRoomRequest::JoinRoomRequest | ( | std::optional< std::string > | name, |
| std::optional< std::string > | pass = std::nullopt, | ||
| std::optional< int32_t > | roomIdToLeave = std::nullopt, | ||
| bool | asSpect = false ) |
Creates a new JoinRoomRequest for the Room with the given name.
| name | The name of the Room to join. |
| pass | The password of the Room, if it is protected by one. |
| roomIdToLeave | The id of a Room joined before, which the user leaves when he joins the new one. |
| asSpect | true to join the Room as a spectator. Game Rooms only. |
| sfs3::requests::JoinRoomRequest::JoinRoomRequest | ( | entities::Room * | theRoom, |
| std::optional< std::string > | pass = std::nullopt, | ||
| std::optional< int32_t > | roomIdToLeave = std::nullopt, | ||
| bool | asSpect = false ) |
Creates a new JoinRoomRequest for the given Room.
| theRoom | The Room to join. The caller keeps the ownership. |
| pass | The password of the Room, if it is protected by one. |
| roomIdToLeave | The id of a Room joined before, which the user leaves when he joins the new one. |
| asSpect | true to join the Room as a spectator. Game Rooms only. |