Diarkis C++Client Library API Document
DiarkisRoomBase Class Reference

Base class that wraps the IDiarkisRoom class for easy use of Room functionality. More...

#include <DiarkisRoomBase.h>

Collaboration diagram for DiarkisRoomBase:

Public Member Functions

 DiarkisRoomBase ()
 DiarkisRoomBase constructor. More...
 
virtual ~DiarkisRoomBase ()
 DiarkisRoomBase destructor. More...
 
virtual void SetupTcpRoom (const std::shared_ptr< IDiarkisTcp > &tcp, const std::shared_ptr< LoggerFactory > &loggerFactory, bool bRetry)
 Set up Room with TCP protocol. More...
 
virtual void SetupUdpRoom (const std::shared_ptr< IDiarkisUdp > &udp, const std::shared_ptr< LoggerFactory > &loggerFactory, const std::shared_ptr< DiarkisP2PBase > &p2pBase, bool bRetry)
 Set up Room with UDP protocol. More...
 
std::shared_ptr< IDiarkisRoomGetRoom ()
 Get the pointer to IDiarkisRoom class. More...
 
void SetJoinRoomID (const char *roomID)
 Set the Room ID. More...
 
void SetJoinRoomID (const std::string &roomID)
 Same as SetJoinRoomID() More...
 
virtual void SendCreateRoom (uint16_t maxMembers, bool allowEmpty, bool join, uint16_t ttl, uint32_t interval)
 Create a new Room. More...
 
virtual void SendJoinRoom (const char *uid)
 Join a Room. More...
 
virtual void SendJoinRoom (const std::string &uid)
 Same as SendJoinRoom(const char*) More...
 
virtual void SendJoinRoom (const char *roomID, const char *uid)
 Joins the Room with the specified Room ID. More...
 
virtual void SendJoinRoom (const std::string &roomID, const std::string &uid)
 Same as SendJoinRoom(const char*, const char*) More...
 
virtual void SendJoinRandomRoom (const char *uid, uint32_t maxMembers, uint16_t ttl, uint32_t interval, bool allowEmpty)
 Join the Room if available, otherwise create a new Room. More...
 
virtual void SendJoinRandomRoom (const std::string &uid, uint32_t maxMembers, uint16_t ttl, uint32_t interval, bool allowEmpty)
 Same as SendJoinRandomRoom() More...
 
virtual void SendBroadcastToRoom (const uint8_t *payload, size_t payloadSize, bool reliable)
 Sends a message to all Room members including yourself. More...
 
virtual void SendBroadcastToRoom (const std::vector< uint8_t > &payload, bool reliable)
 Same as SendBroadcastToRoom() More...
 
virtual void SendMessageToRoom (const char **memberIDs, size_t memberIDsCount, const uint8_t *payload, size_t payloadSize, bool reliable)
 Sends a message to a specific member who has joined a Room. More...
 
virtual void SendMessageToRoom (const std::vector< std::string > &memberIDs, const std::vector< uint8_t > &payload, bool reliable)
 Same as SendMessageToRoom() More...
 
virtual void SendRelay (const uint8_t *payload, size_t payloadSize, bool reliable)
 Sends a message to Room members other than yourself. More...
 
virtual void SendRelay (const std::vector< uint8_t > &payload, bool reliable)
 Same as SendRelay() More...
 
virtual void SendRelayTo (const char **memberIDs, size_t memberIDsCount, const uint8_t *payload, size_t payloadSize, bool reliable)
 Sends a message to a specific member participating in a Room. More...
 
virtual void SendRelayTo (const std::vector< std::string > &memberIDs, const std::vector< uint8_t > &payload, bool reliable)
 Same as SendRelayTo() More...
 
virtual void SendLeaveRoom (const char *uid)
 Leaving a Room. More...
 
virtual void SendLeaveRoom (const std::string &uid)
 Same as SendLeaveRoom() More...
 
virtual void SendFindByTypeRoom (uint32_t roomType, uint32_t limit)
 Searches for Rooms of the same type. More...
 
virtual void SendRegisterRoom (uint32_t roomType, const char *roomName, const char *roomMetadata)
 Register additional information about the Room you are participating in. More...
 
virtual void SendRegisterRoom (uint32_t roomType, const std::string &roomName, const std::string &roomMetadata)
 Same as SendRegisterRoom() More...
 
virtual void SendMigrateRoom (void)
 Move the Room to a different server. More...
 
virtual void SendGetOwnerID (void)
 Get the Room owner's user ID. More...
 
virtual void SendGetMemberIDs (void)
 Get a list of user IDs of members participating in a Room. More...
 
virtual void SendGetNumberOfMembers (void)
 Get the number of members in the Room. More...
 
virtual void SendUpdateProperties (const std::unordered_map< std::string, std::vector< uint8_t >> &properties, bool sync=false)
 Set Room properties. More...
 
virtual void SendGetProperties (const char **propertyNames, size_t propertyNamesCount)
 Get Room properties. More...
 
virtual void SendGetProperties (const std::vector< std::string > &propertyNames)
 Same as SendGetProperties() More...
 
virtual void SendIncrementProperty (Diarkis::StdString propertyName, int64_t delta, bool sync)
 Increases or decreases the value of the specified Room property. More...
 
virtual void SendReserveRoom (const char **userIDs, size_t userIDsCount)
 Reserves a member to join a Room. More...
 
virtual void SendReserveRoom (const std::vector< std::string > &userIDs)
 Same as SendReserveRoom() More...
 
virtual void SendCancelReservationRoom (const char *cancelRoomID, const char **userIDs, size_t userIDsCount)
 Cancels a Room reservation. More...
 
virtual void SendCancelReservationRoom (const std::string &cancelRoomID, const std::vector< std::string > &userIDs)
 Same as SendCancelReservationRoom() More...
 
virtual void SendChatMessage (const char *message)
 Sends a chat message to the Room members. More...
 
virtual void SendChatMessage (const std::string &message)
 Same as SendChatMessage() More...
 
virtual void SendGetChatLog (void)
 Retrieve past chat messages. More...
 
virtual void SendStartP2PSync (uint8_t linkedClients=0)
 Starts P2P communication with the members participating in the Room. More...
 
virtual void SendUpdateObject (RoomObjectMode mode, const std::string &name, const std::unordered_map< std::string, double > &obj, bool reliable=true)
 Updates the Room object. More...
 
bool IsJoin ()
 Whether or not you are participating in the Room. More...
 
bool IsFail ()
 Whether or not you failed to join the Room. More...
 
bool IsFind ()
 Whether the Room was found by FindRoomsByType. More...
 
bool IsNotFind ()
 Whether the Room was not found by FindRoomsByType. More...
 
bool IsMigrate ()
 Whether the Room is under migration or not. More...
 
bool IsLeave ()
 Whether or not you have left the Room. More...
 
bool IsReserve ()
 Whether you reserved a Room or not. More...
 
Diarkis::StdString GetRoomID (void)
 Get the Room ID of the Room you are participating in. More...
 
Diarkis::StdString GetOwnerUID (void)
 Retrieves the user ID of the participating Room owner. More...
 
Diarkis::StdString GetOwnUID (void) const
 Obtain your own user ID. More...
 
void SetOwnUID (const char *uid)
 Set your own user ID. More...
 
void SetOwnUID (const std::string &uid)
 Same as SetOwnUID() More...
 
void GetRoomMembers (Diarkis::StdVector< Diarkis::StdString > &memberList)
 Get the user IDs of the members of the Room. More...
 
const Diarkis::StdVector< Diarkis::StdString > & GetRoomMembers () const
 Get the user IDs of the members of the Room. More...
 

Protected Member Functions

virtual void OnRoomCreation (const DiarkisRoomCreationEventArgs &e)
 Callback function called when a Room is created. More...
 
virtual void OnRoomJoin (const DiarkisRoomJoinEventArgs &e)
 Callback function called when joined a Room. More...
 
virtual void OnRoomLeave (const DiarkisRoomSuccessEventArgs &e)
 Callback function called when left from a Room. More...
 
virtual void OnRoomMigrateStart (void)
 Callback function called when a Room migration starts. More...
 
virtual void OnRoomMigrateComplete (const DiarkisRoomMigrateCompleteEventArgs &e)
 Callback function called when a Room migration is completed. More...
 
virtual void OnRoomMemberJoin (const DiarkisPayloadEventArgs &e)
 Callback function called when another client joins the Room. More...
 
virtual void OnRoomMemberLeave (const DiarkisPayloadEventArgs &e)
 Callback function called when a Room member leaves the Room. More...
 
virtual void OnRoomUpdateProperties (const DiarkisRoomSuccessEventArgs &e)
 Callback function called when properties are updated with UpdateProperties. More...
 
virtual void OnRoomGetProperties (const DiarkisRoomPropertiesEventArgs &e)
 Callback function called when properties are retrieved with GetProperties. More...
 
virtual void OnRoomUpdateSyncProperties (const DiarkisRoomPropertiesEventArgs &e)
 Callback function called when properties are updated with UpdateProperties. More...
 
virtual void OnRoomIncrementProperty (const DiarkisRoomIncrementPropertyEventArgs &e)
 Callback function called when the property is changed with IncrementProperty. More...
 
virtual void OnRoomIncrementPropertySync (const DiarkisRoomIncrementPropertySyncEventArgs &e)
 Callback function called when the property is changed with IncrementProperty. More...
 
virtual void OnRoomGetOwnerID (const DiarkisRoomGetOwnerIDEventArgs &e)
 Callback function called when the user ID of a participating Room owner is obtained. More...
 
virtual void OnRoomMemberIDs (const DiarkisRoomMemberIDsEventArgs &e)
 Callback function called to retrieve the user IDs of participating Room members. More...
 
virtual void OnRoomNumberOfMembers (const DiarkisRoomNumberOfMembersEventArgs &e)
 Callback function called to get the number of members in a Room. More...
 
virtual void OnRoomOwnerChange (const DiarkisRoomGetOwnerIDEventArgs &e)
 Callback function called when the Room owner is changed. More...
 
virtual void OnRoomMemberBroadcast (const DiarkisPayloadEventArgs &e)
 Callback function called when received a Broadcast message. More...
 
virtual void OnRoomMemberMessage (const DiarkisPayloadEventArgs &e)
 Callback function called when received a message by MessageTo. More...
 
virtual void OnRoomRelay (const DiarkisPayloadEventArgs &e)
 Callback function called when received a message by Relay. More...
 
virtual void OnRoomRelayTo (const DiarkisPayloadEventArgs &e)
 Callback function called when received a message by RelayTo. More...
 
virtual void OnRoomRegister (const DiarkisRoomPayloadEventArgs &e)
 Callback function called when additional information is registered for a participating Room. More...
 
virtual void OnRoomFindByType (const DiarkisRoomFindByTypeEventArgs &e)
 Callback function called when a FindRoomsByType search result is received. More...
 
virtual void OnRoomReserve (const DiarkisRoomPayloadEventArgs &e)
 Callback function called when a response to Reserve is received. More...
 
virtual void OnRoomCancelReserve (const DiarkisRoomPayloadEventArgs &e)
 Callback function called when a response to CancelReservation is received. More...
 
virtual void OnChatSyncResponse (const DiarkisRoomPayloadEventArgs &e)
 Callback function called when a response to a chat transmission is received. More...
 
virtual void OnChatSync (const DiarkisRoomChatEventArgs &e)
 Callback function called when chat is received. More...
 
virtual void OnRoomChatLog (const DiarkisRoomChatLogEventArgs &e)
 Callback function called when a response to GetChatLog is received. More...
 
virtual void OnStartP2PSync (const DiarkisP2PEventArgs &e)
 StartP2PSyncプッシュ通知を受信したときに呼び出されるコールバック関数 More...
 
virtual void OnRoomObjectUpdate (const DiarkisRoomObjectUpdateEventArgs &e)
 Callback event called when a UpdateObject push is received. More...
 
virtual void OnRoomObjectUpdateResponse (const DiarkisRoomObjectUpdateResponseEventArgs &e)
 Callback event called when a response is received to an update of a Room object. More...
 
virtual void OnOffline ()
 Callback event called when the server is ready to shutdown. More...
 

Protected Attributes

std::shared_ptr< IDiarkisTcptcp_
 Pointer to IDiarkisTcp class. More...
 
std::shared_ptr< IDiarkisUdpudp_
 Pointer to IDiarkisUdp class. More...
 
std::shared_ptr< IDiarkisRoomroom_
 Pointer to IDiarkisRoom class. More...
 
std::shared_ptr< DiarkisP2PBasep2pBase_
 Pointer to DiarkisP2PBase class. More...
 
std::shared_ptr< IDiarkisLoggerlogger_
 Pointer to IDiarkisLogger class. More...
 
Diarkis::StdVector< std::function< void()> > eventUnsubscriptions_
 Lambda functions list. More...
 
Diarkis::StdString roomID_
 Room ID of the participating Room. More...
 
ConnectState roomConnect_
 Room state. More...
 
std::recursive_mutex list_mutex_
 roomMemberIDs Mutex More...
 
Diarkis::StdVector< Diarkis::StdStringroomMemberIDs_
 List of Room members' user IDs. More...
 
Diarkis::StdString ownUID_
 自分のユーザーID More...
 
Diarkis::StdString ownerID_
 User ID of the Room owner. More...
 
int64_t createAtServer_
 The time the Room you are currently in was created on the server. More...
 
bool bReserved_
 Whether you reserved a Room or not. More...
 

Detailed Description

Base class that wraps the IDiarkisRoom class for easy use of Room functionality.

Constructor & Destructor Documentation

◆ DiarkisRoomBase()

DiarkisRoomBase::DiarkisRoomBase ( )

DiarkisRoomBase constructor.

Here is the call graph for this function:

◆ ~DiarkisRoomBase()

DiarkisRoomBase::~DiarkisRoomBase ( )
virtual

DiarkisRoomBase destructor.

Member Function Documentation

◆ SetupTcpRoom()

void DiarkisRoomBase::SetupTcpRoom ( const std::shared_ptr< IDiarkisTcp > &  tcp,
const std::shared_ptr< LoggerFactory > &  loggerFactory,
bool  bRetry 
)
virtual

Set up Room with TCP protocol.

Register loggers and callback functions.

Parameters
[in]tcpPointer to IDiarkisTcp class
[in]loggerFactoryPointer to logger class
[in]bRetryCall this function with true when reconnecting after a failed attempt to join a Room. The first call to this function must be false.
Here is the call graph for this function:

◆ SetupUdpRoom()

void DiarkisRoomBase::SetupUdpRoom ( const std::shared_ptr< IDiarkisUdp > &  udp,
const std::shared_ptr< LoggerFactory > &  loggerFactory,
const std::shared_ptr< DiarkisP2PBase > &  p2pBase,
bool  bRetry 
)
virtual

Set up Room with UDP protocol.

Register loggers and callback functions.

Parameters
[in]udpPointer to IDiarkisUdp class
[in]loggerFactoryRoom Log for client library
[in]p2pBasePointer to DiarkisP2PBase class
[in]bRetryCall this function with true when reconnecting after a failed attempt to join a Room. The first call to this function must be false.
Here is the call graph for this function:

◆ GetRoom()

std::shared_ptr< IDiarkisRoom > DiarkisRoomBase::GetRoom ( )

Get the pointer to IDiarkisRoom class.

◆ SetJoinRoomID() [1/2]

void DiarkisRoomBase::SetJoinRoomID ( const char *  roomID)

Set the Room ID.

Parameters
[in]roomIDRoom ID to set
Here is the caller graph for this function:

◆ SetJoinRoomID() [2/2]

void DiarkisRoomBase::SetJoinRoomID ( const std::string &  roomID)

Same as SetJoinRoomID()

Here is the call graph for this function:

◆ SendCreateRoom()

void DiarkisRoomBase::SendCreateRoom ( uint16_t  maxMembers,
bool  allowEmpty,
bool  join,
uint16_t  ttl,
uint32_t  interval 
)
virtual

Create a new Room.

A callback event (e.g. OnRoomCreation) registered with GetCreateEvent() will be triggered.

Parameters
[in]maxMembersMaximum number of clients that can join the Room to be created.
[in]allowEmptyDetermines if the Room will be held even if none of the clients have joined.
[in]joinDetermines if the Room will be joined after it is created.
true = join the Room after creating it. No Join response is sent from the server.
false = only creates the Room. If you want to join the Room, you must perform a separate Join.
[in]ttlSpecifies the duration of the Room in seconds after it is empty. Used only when true is specified for allowEmpty.
[in]intervalSpecifies the interval in milliseconds at which the server processes Broadcast messages, etc.
If the value of interval is large, the server load will be reduced, but there will be a delay in receiving messages. If the value of
If the value of interval is small, the server load will increase, but the message will be sent immediately from the server.
The default value is 200 ms.
Here is the call graph for this function:

◆ SendJoinRoom() [1/4]

void DiarkisRoomBase::SendJoinRoom ( const char *  uid)
virtual

Join a Room.

Callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Callback event registered with GetMemberJoinEvent() (e.g. OnRoomMemberJoin) will be triggered on the member of the Room. The user ID specified by uid can be received from the callback event.

Parameters
[in]uidYour user ID
Here is the caller graph for this function:

◆ SendJoinRoom() [2/4]

void DiarkisRoomBase::SendJoinRoom ( const std::string &  uid)
virtual

Same as SendJoinRoom(const char*)

Here is the call graph for this function:

◆ SendJoinRoom() [3/4]

void DiarkisRoomBase::SendJoinRoom ( const char *  roomID,
const char *  uid 
)
virtual

Joins the Room with the specified Room ID.

Callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Callback event registered with GetMemberJoinEvent() (e.g. OnRoomMemberJoin) will be triggered on the member of the Room.
The user ID specified by uid can be received from the callback event.

Parameters
[in]roomIDID of the Room to join
[in]uidYour user ID
Here is the call graph for this function:

◆ SendJoinRoom() [4/4]

void DiarkisRoomBase::SendJoinRoom ( const std::string &  roomID,
const std::string &  uid 
)
virtual

Same as SendJoinRoom(const char*, const char*)

Here is the call graph for this function:

◆ SendJoinRandomRoom() [1/2]

void DiarkisRoomBase::SendJoinRandomRoom ( const char *  uid,
uint32_t  maxMembers,
uint16_t  ttl,
uint32_t  interval,
bool  allowEmpty 
)
virtual

Join the Room if available, otherwise create a new Room.

When a new Room is created, the callback event registered with GetCreateEvent() (e.g. OnRoomCreation) and
callback event registered with GetJoinEvent() (e.g. OnRoomJoin) will be triggered.
Only callback events registered with GetJoinEvent() will be triggered when joining an existing Room.

Parameters
[in]uidyour user ID
[in]maxMembersMaximum number of clients that can join the Room to be created.
[in]ttlDuration in seconds after the Room is empty, used only when allowEmpty is set to true.
[in]intervalSpecifies the interval in milliseconds at which the server processes messages.
Messages are sent together at the server for the interval time.
If the value of interval is large, the server load will be reduced, but there will be a delay in receiving messages.
If the value of interval is small, the server load will increase, but the message will be sent immediately from the server.
The default value is 200 ms.
[in]allowEmptyDetermines whether or not the client will keep the Room even when no one is joining.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendJoinRandomRoom() [2/2]

void DiarkisRoomBase::SendJoinRandomRoom ( const std::string &  uid,
uint32_t  maxMembers,
uint16_t  ttl,
uint32_t  interval,
bool  allowEmpty 
)
virtual

Same as SendJoinRandomRoom()

Here is the call graph for this function:

◆ SendBroadcastToRoom() [1/2]

void DiarkisRoomBase::SendBroadcastToRoom ( const uint8_t *  payload,
size_t  payloadSize,
bool  reliable 
)
virtual

Sends a message to all Room members including yourself.

Triggers a callback event (e.g. OnRoomMemberBroadcast) registered with GetMemberBroadcastEvent().

Parameters
[in]payloadMessage to be sent
[in]payloadSizeLength of the payload
[in]reliableDetermines if the message is sent via reliable communication (RUDP); ignored for TCP protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendBroadcastToRoom() [2/2]

void DiarkisRoomBase::SendBroadcastToRoom ( const std::vector< uint8_t > &  payload,
bool  reliable 
)
virtual

Same as SendBroadcastToRoom()

Here is the call graph for this function:

◆ SendMessageToRoom() [1/2]

void DiarkisRoomBase::SendMessageToRoom ( const char **  memberIDs,
size_t  memberIDsCount,
const uint8_t *  payload,
size_t  payloadSize,
bool  reliable 
)
virtual

Sends a message to a specific member who has joined a Room.

A callback event (e.g. OnRoomMemberMessage) registered with GetMemberMessageEvent() will be triggered.

Parameters
[in]memberIDsList of user IDs of members to send
[in]memberIDsCountNumber of memberID
[in]payloadMessage to be sent
[in]payloadSizeLength of the payload
[in]reliableDetermines if the message is sent via reliable communication (RUDP); ignored for TCP protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendMessageToRoom() [2/2]

void DiarkisRoomBase::SendMessageToRoom ( const std::vector< std::string > &  memberIDs,
const std::vector< uint8_t > &  payload,
bool  reliable 
)
virtual

Same as SendMessageToRoom()

Here is the call graph for this function:

◆ SendRelay() [1/2]

void DiarkisRoomBase::SendRelay ( const uint8_t *  payload,
size_t  payloadSize,
bool  reliable 
)
virtual

Sends a message to Room members other than yourself.

Unlike Broadcast, messages are not compiled by the server.
A callback event registered with GetRelayEvent() (e.g. OnRelay) will be triggered.

Parameters
[in]payloadMessage to be sent
[in]payloadSizeLength of the payload
[in]reliableDetermines if the message is sent via reliable communication (RUDP); ignored for TCP protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendRelay() [2/2]

void DiarkisRoomBase::SendRelay ( const std::vector< uint8_t > &  payload,
bool  reliable 
)
virtual

Same as SendRelay()

Here is the call graph for this function:

◆ SendRelayTo() [1/2]

void DiarkisRoomBase::SendRelayTo ( const char **  memberIDs,
size_t  memberIDsCount,
const uint8_t *  payload,
size_t  payloadSize,
bool  reliable 
)
virtual

Sends a message to a specific member participating in a Room.

Unlike MessageTo, messages are not compiled by the server.
A callback event (e.g. OnRelayTo) registered with GetRelayToEvent() will be triggered.

Parameters
[in]memberIDsList of user IDs of members to be sent.
[in]memberIDsCountNumber of memberID
[in]payloadMessage to be sent
[in]payloadSizeLength of the payload
[in]reliableDetermines if the message is sent via reliable communication (RUDP); ignored for TCP protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendRelayTo() [2/2]

void DiarkisRoomBase::SendRelayTo ( const std::vector< std::string > &  memberIDs,
const std::vector< uint8_t > &  payload,
bool  reliable 
)
virtual

Same as SendRelayTo()

Here is the call graph for this function:

◆ SendLeaveRoom() [1/2]

void DiarkisRoomBase::SendLeaveRoom ( const char *  uid)
virtual

Leaving a Room.

Callback event (e.g. OnRoomLeave) registered with GetLeaveEvent() will be triggered.
If the exit is successful, a callback event (e.g. OnRoomMemberLeave) registered with GetMemberLeaveEvent()
will be triggered on each member of the Room.

Parameters
[in]uidown user ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendLeaveRoom() [2/2]

void DiarkisRoomBase::SendLeaveRoom ( const std::string &  uid)
virtual

Same as SendLeaveRoom()

Here is the call graph for this function:

◆ SendFindByTypeRoom()

void DiarkisRoomBase::SendFindByTypeRoom ( uint32_t  roomType,
uint32_t  limit 
)
virtual

Searches for Rooms of the same type.

Callback events registered with GetFindByTypeEvnet() (e.g. OnRoomFindByType) will be triggered.
In the callback event, you can receive a list of Rooms as a result of the search.

Parameters
[in]roomTypeType of Room to search
[in]limitMaximum number of Rooms in the list of search results
Here is the call graph for this function:

◆ SendRegisterRoom() [1/2]

void DiarkisRoomBase::SendRegisterRoom ( uint32_t  roomType,
const char *  roomName,
const char *  roomMetadata 
)
virtual

Register additional information about the Room you are participating in.

Affects searching for a type by FindRoomsByType.

Parameters
[in]roomTypeRoom type
[in]roomNameRoom name
[in]roomMetadataExtended string of Room
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendRegisterRoom() [2/2]

void DiarkisRoomBase::SendRegisterRoom ( uint32_t  roomType,
const std::string &  roomName,
const std::string &  roomMetadata 
)
virtual

Same as SendRegisterRoom()

Here is the call graph for this function:

◆ SendMigrateRoom()

void DiarkisRoomBase::SendMigrateRoom ( void  )
virtual

Move the Room to a different server.

Only the Room owner can call this function.
Upon successful execution, a notification is sent from the server to each member of the Room
and the callback event registered with GetMigrateEvent() (e.g. OnRoomMigrate) is triggered.
The library internally leaves from the currently joined Room and joins a new Room to the server.

Here is the call graph for this function:

◆ SendGetOwnerID()

void DiarkisRoomBase::SendGetOwnerID ( void  )
virtual

Get the Room owner's user ID.

The callback event (e.g. OnGetOwnerID) registered with GetOwnerIDEvent() will be triggered.

◆ SendGetMemberIDs()

void DiarkisRoomBase::SendGetMemberIDs ( void  )
virtual

Get a list of user IDs of members participating in a Room.

Callback events (e.g. OnRoomMemberIDs) registered with GetMemberIDSEvent() will be triggered.

Here is the caller graph for this function:

◆ SendGetNumberOfMembers()

void DiarkisRoomBase::SendGetNumberOfMembers ( void  )
virtual

Get the number of members in the Room.

The callback event (e.g. OnRoomNumberOfMembers) registered with GetNumberOfMembersEvent() will be triggered.

◆ SendUpdateProperties()

void DiarkisRoomBase::SendUpdateProperties ( const std::unordered_map< std::string, std::vector< uint8_t >> &  properties,
bool  sync = false 
)
virtual

Set Room properties.

The callback event registered with GetUpdatePropertiesEvent() (e.g. OnRoomUpdateProperties) will be triggered.

Parameters
[in]propertiesSpecify properties and data to be registered.
[in]syncDetermines if other clients will be notified.
Here is the call graph for this function:

◆ SendGetProperties() [1/2]

void DiarkisRoomBase::SendGetProperties ( const char **  propertyNames,
size_t  propertyNamesCount 
)
virtual

Get Room properties.

The callback event (e.g. OnRoomGetProperties) registered with GetGetPropertiesEvent() will be triggered.

Parameters
[in]propertyNamesSpecify the name of the property to be acquired.
[in]propertyNamesCountNumber of property name
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendGetProperties() [2/2]

void DiarkisRoomBase::SendGetProperties ( const std::vector< std::string > &  propertyNames)
virtual

Same as SendGetProperties()

Here is the call graph for this function:

◆ SendIncrementProperty()

void DiarkisRoomBase::SendIncrementProperty ( Diarkis::StdString  propertyName,
int64_t  delta,
bool  sync 
)
virtual

Increases or decreases the value of the specified Room property.

Callback events registered with GetIncrementPropertyEvent() (e.g. OnRoomIncrementProperty) will be triggered.

Parameters
[in]propertyNameName of the property to be increased or decreased.
[in]deltaSize of the value to be increased or decreased
[in]syncDetermines if other clients will be notified.
If true, callback events registered with GetIncrementPropertySyncEvent() will be triggered.
Here is the call graph for this function:

◆ SendReserveRoom() [1/2]

void DiarkisRoomBase::SendReserveRoom ( const char **  userIDs,
size_t  userIDsCount 
)
virtual

Reserves a member to join a Room.

A callback event (e.g. OnRoomReserve) registered with GetReserveEvent() will be triggered.

Parameters
[in]userIDsList of user IDs of members to reserve.
[in]userIDsCountNumber of user ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendReserveRoom() [2/2]

void DiarkisRoomBase::SendReserveRoom ( const std::vector< std::string > &  userIDs)
virtual

Same as SendReserveRoom()

Here is the call graph for this function:

◆ SendCancelReservationRoom() [1/2]

void DiarkisRoomBase::SendCancelReservationRoom ( const char *  cancelRoomID,
const char **  userIDs,
size_t  userIDsCount 
)
virtual

Cancels a Room reservation.

The callback event (e.g. OnRoomReserve) registered with GetCancelReservationEvent() will be triggered.

Parameters
[in]cancelRoomIDRoom ID of the Room to be canceled
[in]userIDsList of user IDs of members to cancel
[in]userIDsCountNumber of user ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendCancelReservationRoom() [2/2]

void DiarkisRoomBase::SendCancelReservationRoom ( const std::string &  cancelRoomID,
const std::vector< std::string > &  userIDs 
)
virtual

Same as SendCancelReservationRoom()

Here is the call graph for this function:

◆ SendChatMessage() [1/2]

void DiarkisRoomBase::SendChatMessage ( const char *  message)
virtual

Sends a chat message to the Room members.

Messages are stored on the server and past messages can be retrieved with GetChatLog().
The client executing this function will trigger a callback event (e.g. OnRoomResponseSync) registered with GetChatSyncResponseEvent().
members will trigger callback events (e.g. OnRoomChatSync) registered with GetChatSyncEvent().

Parameters
[in]messageMessage to be sent
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendChatMessage() [2/2]

void DiarkisRoomBase::SendChatMessage ( const std::string &  message)
virtual

Same as SendChatMessage()

Here is the call graph for this function:

◆ SendGetChatLog()

void DiarkisRoomBase::SendGetChatLog ( void  )
virtual

Retrieve past chat messages.

Callback events registered with GetChatLogEvent() (e.g. OnRoomChatLog) will be triggered.

Here is the call graph for this function:

◆ SendStartP2PSync()

void DiarkisRoomBase::SendStartP2PSync ( uint8_t  linkedClients = 0)
virtual

Starts P2P communication with the members participating in the Room.

Triggers a callback event (e.g. OnStartP2PSync) registered with GetStartP2PSyncEvent().
Receive a list of peer addresses in the callback event.
This function must be executed by only one of the Room members.

Parameters
[in]linkedClientsSpecifies the number of clients to establish a P2P connection.
0 = Receive addresses of all matched members.
n = Receive addresses of n randomly selected members from among the matched members.

◆ SendUpdateObject()

void DiarkisRoomBase::SendUpdateObject ( RoomObjectMode  mode,
const std::string &  name,
const std::unordered_map< std::string, double > &  obj,
bool  reliable = true 
)
virtual

Updates the Room object.

Successful execution triggers a callback event (e.g. OnRoomObjectUpdate) registered with GetObjectUpdateEvent().
Notification is sent to all members of the Room, including yourself.

Parameters
[in]modeMode to operate the object.
[in]nameName of the object
[in]objSpecifies an object by a list of keys and values.
e.g. obj["x"] = 123.4;
e.g. obj["y"] = 567.8;
e.g. obj["hp"] = 300.0;
If mode is OBJ_DEL_MODE, this parameter is not used because the target object is deleted.
[in]reliableDetermines whether to send via reliable communication (RUDP); ignored for TCP protocol.
Here is the call graph for this function:

◆ IsJoin()

bool DiarkisRoomBase::IsJoin ( )

Whether or not you are participating in the Room.

◆ IsFail()

bool DiarkisRoomBase::IsFail ( )

Whether or not you failed to join the Room.

◆ IsFind()

bool DiarkisRoomBase::IsFind ( )

Whether the Room was found by FindRoomsByType.

◆ IsNotFind()

bool DiarkisRoomBase::IsNotFind ( )

Whether the Room was not found by FindRoomsByType.

◆ IsMigrate()

bool DiarkisRoomBase::IsMigrate ( )

Whether the Room is under migration or not.

◆ IsLeave()

bool DiarkisRoomBase::IsLeave ( )

Whether or not you have left the Room.

◆ IsReserve()

bool DiarkisRoomBase::IsReserve ( )

Whether you reserved a Room or not.

◆ GetRoomID()

Diarkis::StdString DiarkisRoomBase::GetRoomID ( void  )

Get the Room ID of the Room you are participating in.

◆ GetOwnerUID()

Diarkis::StdString DiarkisRoomBase::GetOwnerUID ( void  )

Retrieves the user ID of the participating Room owner.

◆ GetOwnUID()

Diarkis::StdString DiarkisRoomBase::GetOwnUID ( void  ) const

Obtain your own user ID.

◆ SetOwnUID() [1/2]

void DiarkisRoomBase::SetOwnUID ( const char *  uid)

Set your own user ID.

Parameters
[in]uidUser ID
Here is the caller graph for this function:

◆ SetOwnUID() [2/2]

void DiarkisRoomBase::SetOwnUID ( const std::string &  uid)

Same as SetOwnUID()

Here is the call graph for this function:

◆ GetRoomMembers() [1/2]

void DiarkisRoomBase::GetRoomMembers ( Diarkis::StdVector< Diarkis::StdString > &  memberList)

Get the user IDs of the members of the Room.

Parameters
[in]memberListArray to write the results to

◆ GetRoomMembers() [2/2]

const Diarkis::StdVector< Diarkis::StdString > & DiarkisRoomBase::GetRoomMembers ( ) const

Get the user IDs of the members of the Room.

◆ OnRoomCreation()

void DiarkisRoomBase::OnRoomCreation ( const DiarkisRoomCreationEventArgs e)
protectedvirtual

Callback function called when a Room is created.

Called when a Room Create response is received from the server.

Here is the call graph for this function:

◆ OnRoomJoin()

void DiarkisRoomBase::OnRoomJoin ( const DiarkisRoomJoinEventArgs e)
protectedvirtual

Callback function called when joined a Room.

Called when a Room Join response is received from the server.

Here is the call graph for this function:

◆ OnRoomLeave()

void DiarkisRoomBase::OnRoomLeave ( const DiarkisRoomSuccessEventArgs e)
protectedvirtual

Callback function called when left from a Room.

Called when a Room Leave response is received from the server.

Here is the call graph for this function:

◆ OnRoomMigrateStart()

void DiarkisRoomBase::OnRoomMigrateStart ( void  )
protectedvirtual

Callback function called when a Room migration starts.

Notified by the server to each member when the Room owner executes Migrate.

◆ OnRoomMigrateComplete()

void DiarkisRoomBase::OnRoomMigrateComplete ( const DiarkisRoomMigrateCompleteEventArgs e)
protectedvirtual

Callback function called when a Room migration is completed.

Here is the call graph for this function:

◆ OnRoomMemberJoin()

void DiarkisRoomBase::OnRoomMemberJoin ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when another client joins the Room.

Here is the call graph for this function:

◆ OnRoomMemberLeave()

void DiarkisRoomBase::OnRoomMemberLeave ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when a Room member leaves the Room.

Here is the call graph for this function:

◆ OnRoomUpdateProperties()

void DiarkisRoomBase::OnRoomUpdateProperties ( const DiarkisRoomSuccessEventArgs e)
protectedvirtual

Callback function called when properties are updated with UpdateProperties.

Here is the call graph for this function:

◆ OnRoomGetProperties()

void DiarkisRoomBase::OnRoomGetProperties ( const DiarkisRoomPropertiesEventArgs e)
protectedvirtual

Callback function called when properties are retrieved with GetProperties.

Here is the call graph for this function:

◆ OnRoomUpdateSyncProperties()

void DiarkisRoomBase::OnRoomUpdateSyncProperties ( const DiarkisRoomPropertiesEventArgs e)
protectedvirtual

Callback function called when properties are updated with UpdateProperties.

Here is the call graph for this function:

◆ OnRoomIncrementProperty()

void DiarkisRoomBase::OnRoomIncrementProperty ( const DiarkisRoomIncrementPropertyEventArgs e)
protectedvirtual

Callback function called when the property is changed with IncrementProperty.

Here is the call graph for this function:

◆ OnRoomIncrementPropertySync()

void DiarkisRoomBase::OnRoomIncrementPropertySync ( const DiarkisRoomIncrementPropertySyncEventArgs e)
protectedvirtual

Callback function called when the property is changed with IncrementProperty.

Here is the call graph for this function:

◆ OnRoomGetOwnerID()

void DiarkisRoomBase::OnRoomGetOwnerID ( const DiarkisRoomGetOwnerIDEventArgs e)
protectedvirtual

Callback function called when the user ID of a participating Room owner is obtained.

Here is the call graph for this function:

◆ OnRoomMemberIDs()

void DiarkisRoomBase::OnRoomMemberIDs ( const DiarkisRoomMemberIDsEventArgs e)
protectedvirtual

Callback function called to retrieve the user IDs of participating Room members.

Here is the call graph for this function:

◆ OnRoomNumberOfMembers()

void DiarkisRoomBase::OnRoomNumberOfMembers ( const DiarkisRoomNumberOfMembersEventArgs e)
protectedvirtual

Callback function called to get the number of members in a Room.

Here is the call graph for this function:

◆ OnRoomOwnerChange()

void DiarkisRoomBase::OnRoomOwnerChange ( const DiarkisRoomGetOwnerIDEventArgs e)
protectedvirtual

Callback function called when the Room owner is changed.

Here is the call graph for this function:

◆ OnRoomMemberBroadcast()

void DiarkisRoomBase::OnRoomMemberBroadcast ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when received a Broadcast message.

Here is the call graph for this function:

◆ OnRoomMemberMessage()

void DiarkisRoomBase::OnRoomMemberMessage ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when received a message by MessageTo.

Here is the call graph for this function:

◆ OnRoomRelay()

void DiarkisRoomBase::OnRoomRelay ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when received a message by Relay.

Here is the call graph for this function:

◆ OnRoomRelayTo()

void DiarkisRoomBase::OnRoomRelayTo ( const DiarkisPayloadEventArgs e)
protectedvirtual

Callback function called when received a message by RelayTo.

Here is the call graph for this function:

◆ OnRoomRegister()

void DiarkisRoomBase::OnRoomRegister ( const DiarkisRoomPayloadEventArgs e)
protectedvirtual

Callback function called when additional information is registered for a participating Room.

Here is the call graph for this function:

◆ OnRoomFindByType()

void DiarkisRoomBase::OnRoomFindByType ( const DiarkisRoomFindByTypeEventArgs e)
protectedvirtual

Callback function called when a FindRoomsByType search result is received.

Here is the call graph for this function:

◆ OnRoomReserve()

void DiarkisRoomBase::OnRoomReserve ( const DiarkisRoomPayloadEventArgs e)
protectedvirtual

Callback function called when a response to Reserve is received.

Here is the call graph for this function:

◆ OnRoomCancelReserve()

void DiarkisRoomBase::OnRoomCancelReserve ( const DiarkisRoomPayloadEventArgs e)
protectedvirtual

Callback function called when a response to CancelReservation is received.

Here is the call graph for this function:

◆ OnChatSyncResponse()

void DiarkisRoomBase::OnChatSyncResponse ( const DiarkisRoomPayloadEventArgs e)
protectedvirtual

Callback function called when a response to a chat transmission is received.

Here is the call graph for this function:

◆ OnChatSync()

void DiarkisRoomBase::OnChatSync ( const DiarkisRoomChatEventArgs e)
protectedvirtual

Callback function called when chat is received.

Here is the call graph for this function:

◆ OnRoomChatLog()

void DiarkisRoomBase::OnRoomChatLog ( const DiarkisRoomChatLogEventArgs e)
protectedvirtual

Callback function called when a response to GetChatLog is received.

Here is the call graph for this function:

◆ OnStartP2PSync()

void DiarkisRoomBase::OnStartP2PSync ( const DiarkisP2PEventArgs e)
protectedvirtual

StartP2PSyncプッシュ通知を受信したときに呼び出されるコールバック関数

@ ~Japanese

Callback function called when StartP2PSync push notification is received

Here is the call graph for this function:

◆ OnRoomObjectUpdate()

void DiarkisRoomBase::OnRoomObjectUpdate ( const DiarkisRoomObjectUpdateEventArgs e)
protectedvirtual

Callback event called when a UpdateObject push is received.

Here is the call graph for this function:

◆ OnRoomObjectUpdateResponse()

void DiarkisRoomBase::OnRoomObjectUpdateResponse ( const DiarkisRoomObjectUpdateResponseEventArgs e)
protectedvirtual

Callback event called when a response is received to an update of a Room object.

Here is the call graph for this function:

◆ OnOffline()

void DiarkisRoomBase::OnOffline ( )
protectedvirtual

Callback event called when the server is ready to shutdown.

Member Data Documentation

◆ tcp_

std::shared_ptr<IDiarkisTcp> DiarkisRoomBase::tcp_
protected

Pointer to IDiarkisTcp class.

◆ udp_

std::shared_ptr<IDiarkisUdp> DiarkisRoomBase::udp_
protected

Pointer to IDiarkisUdp class.

◆ room_

std::shared_ptr<IDiarkisRoom> DiarkisRoomBase::room_
protected

Pointer to IDiarkisRoom class.

◆ p2pBase_

std::shared_ptr<DiarkisP2PBase> DiarkisRoomBase::p2pBase_
protected

Pointer to DiarkisP2PBase class.

◆ logger_

std::shared_ptr<IDiarkisLogger> DiarkisRoomBase::logger_
protected

Pointer to IDiarkisLogger class.

◆ eventUnsubscriptions_

Diarkis::StdVector<std::function<void()> > DiarkisRoomBase::eventUnsubscriptions_
protected

Lambda functions list.

◆ roomID_

Diarkis::StdString DiarkisRoomBase::roomID_
protected

Room ID of the participating Room.

◆ roomConnect_

ConnectState DiarkisRoomBase::roomConnect_
protected

Room state.

◆ list_mutex_

std::recursive_mutex DiarkisRoomBase::list_mutex_
protected

roomMemberIDs Mutex

◆ roomMemberIDs_

Diarkis::StdVector<Diarkis::StdString> DiarkisRoomBase::roomMemberIDs_
protected

List of Room members' user IDs.

◆ ownUID_

Diarkis::StdString DiarkisRoomBase::ownUID_
protected

自分のユーザーID

~@japanese

My user ID

◆ ownerID_

Diarkis::StdString DiarkisRoomBase::ownerID_
protected

User ID of the Room owner.

◆ createAtServer_

int64_t DiarkisRoomBase::createAtServer_
protected

The time the Room you are currently in was created on the server.

◆ bReserved_

bool DiarkisRoomBase::bReserved_
protected

Whether you reserved a Room or not.


The documentation for this class was generated from the following files: