package room
import "github.com/Diarkis/diarkis/client/go/modules/room"
Index
- Constants
- type ChatData
- type ListItem
-
type Room
- func (room *Room) BroadcastTo(roomID string, message []byte, reliable bool)
- func (room *Room) CancelReservation(userIDs []string)
- func (room *Room) Chat(msg string)
- func (room *Room) Create(maxMembers uint16, allowEmpty bool, join bool, ttl uint16, interval uint16)
- func (room *Room) CreateOrJoinByCustomID(customID string, maxMembers uint16, interval uint16, ...)
- func (room *Room) CreateRoomWithOwnershipTransfer(maxMembers uint16, allowEmpty bool, join bool, ttl uint16, interval uint16, ...)
- func (room *Room) DeleteOnCreate()
- func (room *Room) DeleteOnCreateRoomWithTransferOwnership()
- func (room *Room) DeleteOnJoin()
- func (room *Room) DeleteOnMemberJoin()
- func (room *Room) DeleteOnMessageExtended()
- func (room *Room) DeleteOnMessageExtendedResponse()
- func (room *Room) DeleteOnTransferOwnershipResponse()
- func (room *Room) FindRoomsByType(roomType int, limit int)
- func (room *Room) GetChatLog()
- func (room *Room) GetMemberIDs()
- func (room *Room) GetNumOfMembers(roomID string)
- func (room *Room) GetOwnerID(roomID string)
- func (room *Room) GetProperty(keys []string)
- func (room *Room) GetRoomInfoByRoomID(roomID string)
- func (room *Room) IncrementProperty(key string, delta int64, sync bool)
- func (room *Room) Join(roomID string, message []byte)
- func (room *Room) JoinRandom(maxMembers int, ttl int, msg []byte, interval int)
- func (room *Room) Leave(roomID string, message []byte)
- func (room *Room) Message(roomID string, memberIDs []string, message []byte, reliable bool)
- func (room *Room) MessageExtended(broadcast bool, memberIDs []string, message []byte, options uint16, ...)
- func (room *Room) Migrate()
- func (room *Room) Move(newRoomID string, leaveMessage []byte, joinMessage []byte, ...)
- func (room *Room) OnCancelReservation(callback func(success bool, msg []byte))
- func (room *Room) OnChatLog(callback func(bool, []ChatData, []byte))
- func (room *Room) OnChatPush(callback func(data ChatData))
- func (room *Room) OnChatSync(callback func(bool, []byte))
- func (room *Room) OnCreate(callback func(bool, string, uint))
- func (room *Room) OnCreateByCustomID(callback func(success bool, roomID string, roomCreatedTime uint, isOwner bool))
- func (room *Room) OnCreateRoomWithTransferOwnership(callback func(bool, string, uint))
- func (room *Room) OnFindRoomsByType(callback func(success bool, room []ListItem))
- func (room *Room) OnGetMemberIDs(callback func(bool, []byte, [][]byte))
- func (room *Room) OnGetNumOfMembers(callback func(bool, []byte, int, int))
- func (room *Room) OnGetOwnerID(callback func(bool, []byte))
- func (room *Room) OnGetRoomInfo(...) bool
- func (room *Room) OnJoin(callback func(bool, uint))
- func (room *Room) OnLeave(callback func(bool))
- func (room *Room) OnMemberBroadcast(callback func([]byte))
- func (room *Room) OnMemberJoin(callback func([]byte))
- func (room *Room) OnMemberLeave(callback func([]byte))
- func (room *Room) OnMemberMessage(callback func([]byte))
- func (room *Room) OnMessageExtended(callback func(message []byte, broadcasted bool, senderID *string))
- func (room *Room) OnMessageExtendedResponse(callback func(bool))
- func (room *Room) OnMigrate(callback func(bool, string))
- func (room *Room) OnObjectUpdatePush(callback func(uint8, string, map[string]float64))
- func (room *Room) OnObjectUpdateResponse(callback func(msg []byte))
- func (room *Room) OnP2PInit(callback func(success bool))
- func (room *Room) OnPropGetResponse(callback func(success bool, props [][]byte))
- func (room *Room) OnPropIncrPush(callback func(success bool, key string, numProps uint64))
- func (room *Room) OnPropIncrResponse(callback func(success bool, numProps int64))
- func (room *Room) OnPropSyncResponse(callback func(success bool, props map[string][]byte))
- func (room *Room) OnPropUpdatePush(callback func(rops map[string][]byte))
- func (room *Room) OnPropUpdateResponse(callback func(success bool))
- func (room *Room) OnRegister(callback func(success bool, msg []byte))
- func (room *Room) OnRelayProfilePush(callback func(msg []byte))
- func (room *Room) OnRelayProfileResponse(callback func(success bool, msg []byte))
- func (room *Room) OnRelayPush(callback func(msg []byte))
- func (room *Room) OnRelayResponse(callback func(success bool, msg []byte))
- func (room *Room) OnRelayToProfilePush(callback func(msg []byte))
- func (room *Room) OnRelayToProfileResponse(callback func(success bool, msg []byte))
- func (room *Room) OnRelayToPush(callback func(msg []byte))
- func (room *Room) OnRelayToResponse(callback func(success bool, msg []byte))
- func (room *Room) OnReserve(callback func(success bool, msg []byte))
- func (room *Room) OnRoomOwnerChange(callback func(message []byte))
- func (room *Room) OnStartP2PSyncDoNotUse()
- func (room *Room) OnTransferOwnershipResponse(callback func(bool))
- func (room *Room) Register(roomType int, roomName string, roomMetadata string)
- func (room *Room) Relay(message []byte, reliable bool)
- func (room *Room) RelayProfile(message []byte, reliable bool)
- func (room *Room) RelayTo(memberIDs []string, message []byte, reliable bool)
- func (room *Room) RelayToProfile(memberIDs []string, message []byte, reliable bool)
- func (room *Room) Reserve(userIDs []string)
- func (room *Room) SetupAsTCP(tcpClient *tcp.Client) bool
- func (room *Room) SetupAsUDP(udpClient *udp.Client) bool
- func (room *Room) SetupOnJoinEvent(ver uint8, cmd uint16)
- func (room *Room) SetupOnOffline(callback func())
- func (room *Room) StartP2PSync(clients uint8)
- func (room *Room) SyncProperties()
- func (room *Room) TransferOwnership(roomID string, newOwnerUID string)
- func (room *Room) UpdateObject(mode byte, name string, obj map[string]float64, reliable bool)
- func (room *Room) UpdateProperty(props map[string][]byte, sync bool)
Constants
const UpdateObjectDelMode = byte(3)
UpdateObjectDelMode deletes a room object by its name.
const UpdateObjectIncrMode = byte(1)
UpdateObjectIncrMode increments an existing room object's properties.
const UpdateObjectSetMode = byte(2)
UpdateObjectSetMode creates or replaces a room object by the given properties.
Types
type ChatData
type ChatData struct { SenderUID string Timestamp int64 Message string }
ChatData represents a chat data This is used for chat log
type ListItem
type ListItem struct { }
ListItem represents a room list item This is used for room finding
type Room
type Room struct { ID string }
Room represents Diarkis Room client
func (*Room) BroadcastTo
func (room *Room) BroadcastTo(roomID string, message []byte, reliable bool)
BroadcastTo broadcasts a message to all members in a room
func (*Room) CancelReservation
func (room *Room) CancelReservation(userIDs []string)
CancelReservation cancels a room reservation
func (*Room) Chat
func (room *Room) Chat(msg string)
Chat sends a message to a room
func (*Room) Create
func (room *Room) Create(maxMembers uint16, allowEmpty bool, join bool, ttl uint16, interval uint16)
Create creates a new room with the specified parameters.
- maxMembers: the maximum number of members allowed in the room
- allowEmpty: whether the room should remain open if empty
- join: whether the creator should automatically join the room upon creation
- ttl: time-to-live duration for the room (in seconds)
- interval: the broadcast interval of the room (in milliseconds)
func (*Room) CreateOrJoinByCustomID
func (room *Room) CreateOrJoinByCustomID(customID string, maxMembers uint16, interval uint16, allowTransferOwnership bool, joinPayload []byte)
CreateOrJoinByCustomID creates a room with the given customID and parameters if an already existing room with the same customID does not exist. Otherwise try to join the room.
- customID: the custom id associated to the room
- maxMembers: the maximum number of members that can join the room
- interval: the broadcast interval of the room
- allowTransferOwnership: if true, ownership of the room can be transferred when the current owner leaves.
- joinPayload: the message to broadcast to existing members of the room if the client joined the room instead of creating it.
func (*Room) CreateRoomWithOwnershipTransfer
func (room *Room) CreateRoomWithOwnershipTransfer(maxMembers uint16, allowEmpty bool, join bool, ttl uint16, interval uint16, allowTransferOwnership bool)
CreateRoomWithOwnershipTransfer creates a new room with the specified parameters.
- maxMembers: the maximum number of members allowed in the room
- allowEmpty: whether the room should remain open if empty
- join: whether the creator should automatically join the room upon creation
- ttl: time-to-live duration for the room (in seconds)
- interval: the broadcast interval of the room (in milliseconds)
- allowTransferOwnership: if true, ownership of the room can be transferred when the current owner leaves
func (*Room) DeleteOnCreate
func (room *Room) DeleteOnCreate()
DeleteOnCreate deletes all of the callbacks assigned via OnCreate
func (*Room) DeleteOnCreateRoomWithTransferOwnership
func (room *Room) DeleteOnCreateRoomWithTransferOwnership()
DeleteOnCreateRoomWithTransferOwnership deletes all of the callbacks assigned via OnCreateRoomWithTransferOwnership
func (*Room) DeleteOnJoin
func (room *Room) DeleteOnJoin()
DeleteOnJoin removes all callbacks assigned via OnJoin
func (*Room) DeleteOnMemberJoin
func (room *Room) DeleteOnMemberJoin()
DeleteOnMemberJoin removes all callbacks assigned via OnJoin
func (*Room) DeleteOnMessageExtended
func (room *Room) DeleteOnMessageExtended()
DeleteOnMessageExtended removes all callbacks set by OnMessageExtended
func (*Room) DeleteOnMessageExtendedResponse
func (room *Room) DeleteOnMessageExtendedResponse()
DeleteOnMessageExtendedResponse removes all callbacks set by OnMessageExtendedResponse
func (*Room) DeleteOnTransferOwnershipResponse
func (room *Room) DeleteOnTransferOwnershipResponse()
DeleteOnTransferOwnershipResponse removes all callbacks set by OnTransferOwnershipResponse
func (*Room) FindRoomsByType
func (room *Room) FindRoomsByType(roomType int, limit int)
FindRoomsByType finds rooms by type - roomType: the type of the room - limit: the maximum number of rooms to return
func (*Room) GetChatLog
func (room *Room) GetChatLog()
GetChatLog gets the chat log of a room
func (*Room) GetMemberIDs
func (room *Room) GetMemberIDs()
GetMemberIDs gets the member IDs of a room
func (*Room) GetNumOfMembers
func (room *Room) GetNumOfMembers(roomID string)
GetNumOfMembers gets the number of members in a room
func (*Room) GetOwnerID
func (room *Room) GetOwnerID(roomID string)
GetOwnerID gets the owner ID of a room - roomID: the ID of the room to get the owner ID of
func (*Room) GetProperty
func (room *Room) GetProperty(keys []string)
GetProperty retrieves properties of the room.
func (*Room) GetRoomInfoByRoomID
func (room *Room) GetRoomInfoByRoomID(roomID string)
GetRoomInfoByRoomID gets room info by roomID
- roomID: the roomID of the room to get info for
func (*Room) IncrementProperty
func (room *Room) IncrementProperty(key string, delta int64, sync bool)
IncrementProperty increments a property of the room.
func (*Room) Join
func (room *Room) Join(roomID string, message []byte)
Join joins a room with the given roomID
func (*Room) JoinRandom
func (room *Room) JoinRandom(maxMembers int, ttl int, msg []byte, interval int)
JoinRandom joins a random room or creates a new room if no room is found
func (*Room) Leave
func (room *Room) Leave(roomID string, message []byte)
Leave leaves a room roomID: the room ID to leave message: the message to send to the room
func (*Room) Message
func (room *Room) Message(roomID string, memberIDs []string, message []byte, reliable bool)
Message sends a message to a room - roomID: the ID of the room to send the message to - memberIDs: the IDs of the members to send the message to - message: the message to send - reliable: whether the message should be sent by RUDP or UDP
func (*Room) MessageExtended
func (room *Room) MessageExtended(broadcast bool, memberIDs []string, message []byte, options uint16, reliable dpacket.ReliableFlag)
MessageExtended sends a message to a room or to a specific members - broadcast: broadcast the message to the room instead of sending it to the given memberIDs - memberIDs: the IDs of the members to send the message to. Ignored if broacast is true - message: the message to send - options: options to affect the format of the payload the server will push to the client - reliable: send the message as reliable
func (*Room) Migrate
func (room *Room) Migrate()
Migrate migrates a room that the user is currently in. This operation can only be performed by the owner of the room. When successful, the owner user raises OnConnect event with reconnect flag true. All members of the room will automatically join the new migrated room without sending join broadcast.
func (*Room) Move
func (room *Room) Move(newRoomID string, leaveMessage []byte, joinMessage []byte, callback func(bool, uint))
Move moves a room that the user is currently in.
func (*Room) OnCancelReservation
func (room *Room) OnCancelReservation(callback func(success bool, msg []byte))
OnCancelReservation assigns a callback on cancel reservation event
func (*Room) OnChatLog
func (room *Room) OnChatLog(callback func(bool, []ChatData, []byte))
OnChatLog assigns a callback on chat log event
func (*Room) OnChatPush
func (room *Room) OnChatPush(callback func(data ChatData))
OnChatPush assigns a callback on chat push event
func (*Room) OnChatSync
func (room *Room) OnChatSync(callback func(bool, []byte))
OnChatSync assigns a callback on chat sync event
func (*Room) OnCreate
func (room *Room) OnCreate(callback func(bool, string, uint))
OnCreate is a callback setter that is called when a room is created The callback is called with the following arguments: - success: whether the room was created successfully - roomID: the ID of the room that was created - roomCreateTime: the time at which the room was create
func (*Room) OnCreateByCustomID
func (room *Room) OnCreateByCustomID(callback func(success bool, roomID string, roomCreatedTime uint, isOwner bool))
OnCreateByCustomID is a callback setter that is called when a room is created with a custom ID The callback is called with the following arguments: - success: whether the room was created successfully - roomID: the ID of the room that was created - roomCreateTime: the time at which the room was create - isOwner: the user is the owner of the room or not
func (*Room) OnCreateRoomWithTransferOwnership
func (room *Room) OnCreateRoomWithTransferOwnership(callback func(bool, string, uint))
OnCreateRoomWithTransferOwnership is a callback setter that is called when a room is created with transfer ownership flag The callback is called with the following arguments: - success: whether the room was created successfully - roomID: the ID of the room that was created - roomCreateTime: the time at which the room was create
func (*Room) OnFindRoomsByType
func (room *Room) OnFindRoomsByType(callback func(success bool, room []ListItem))
OnFindRoomsByType is a callback setter that is called when a room is created The callback is called with the following arguments: - success: whether the room was created successfully - roomListItem: the list of roomListItem
func (*Room) OnGetMemberIDs
func (room *Room) OnGetMemberIDs(callback func(bool, []byte, [][]byte))
OnGetMemberIDs assigns a callback on get member IDs event
func (*Room) OnGetNumOfMembers
func (room *Room) OnGetNumOfMembers(callback func(bool, []byte, int, int))
OnGetNumOfMembers assigns a callback on get number of members event
func (*Room) OnGetOwnerID
func (room *Room) OnGetOwnerID(callback func(bool, []byte))
OnGetOwnerID assigns a callback on get owner ID event The callback is called with the following arguments: - success: whether the room was joined successfully - ownerID: the ID of the owner of the room
func (*Room) OnGetRoomInfo
func (room *Room) OnGetRoomInfo(callback func(roomID string, currentMembers uint16, maxMembers uint16, memberIDs []string, ownerID string, allowEmpty bool, ttl int64, lastPropUpdated int64, updaterSID string, interval int64, created int64, reserves []string, allowTransferOwnership bool)) bool
OnGetRoomInfo assigns a callback on room get room info event The callback is called with the following arguments:
- roomID: the roomID of the selected room
- currentMembers: the current number of members in the room
- maxMembers: the maximum number of possible room members
- memberIDs: IDs of all current room members
- ownerID: ID of room owner
- allowEmpty: allow room discard when empty
- ttl: room TTL
- lastPropUpdated: time of last property update (milliseconds)
- updaterSID: SID of current room updater
- interval: room buffer interval (milliseconds)
- created: room creation time (milliseconds)
- reserves: IDs of current room reserved members
- allowTransferOwnership: if true, ownership of the room can be transferred when the current owner leaves
func (*Room) OnJoin
func (room *Room) OnJoin(callback func(bool, uint))
OnJoin is a callback setter that is called when a room is joined The callback is called with the following arguments: - success: whether the room was joined successfully - roomCreatedTime: the time at which the room was created
func (*Room) OnLeave
func (room *Room) OnLeave(callback func(bool))
OnLeave assigns a callback on leave event
func (*Room) OnMemberBroadcast
func (room *Room) OnMemberBroadcast(callback func([]byte))
OnMemberBroadcast assigns a callback on member broadcast event
func (*Room) OnMemberJoin
func (room *Room) OnMemberJoin(callback func([]byte))
OnMemberJoin assigns a callback on member join event
func (*Room) OnMemberLeave
func (room *Room) OnMemberLeave(callback func([]byte))
OnMemberLeave assigns a callback on member leave event
func (*Room) OnMemberMessage
func (room *Room) OnMemberMessage(callback func([]byte))
OnMemberMessage is a callback setter that is called when a message is received from a member The callback is called with the following arguments: - message: the message that was received
func (*Room) OnMessageExtended
func (room *Room) OnMessageExtended(callback func(message []byte, broadcasted bool, senderID *string))
OnMessageExtended is a callback setter that is called when a message extended is received from a member The callback is called with the following arguments: - message: the message that was received - broadcasted: if true the message was broadcasted to all members - senderID: if non nil the id of the user who sent the message
func (*Room) OnMessageExtendedResponse
func (room *Room) OnMessageExtendedResponse(callback func(bool))
OnMessageExtendedResponse is a callback setter that is called when a room's message extended failed. The callback is called with the following argument: - success: whether the message extended was successful
func (*Room) OnMigrate
func (room *Room) OnMigrate(callback func(bool, string))
OnMigrate assigns a callback on migrate event
func (*Room) OnObjectUpdatePush
func (room *Room) OnObjectUpdatePush(callback func(uint8, string, map[string]float64))
OnObjectUpdatePush assigns a callback on object update push event
func (*Room) OnObjectUpdateResponse
func (room *Room) OnObjectUpdateResponse(callback func(msg []byte))
OnObjectUpdateResponse assigns a callback on object update response event
func (*Room) OnP2PInit
func (room *Room) OnP2PInit(callback func(success bool))
OnP2PInit is a callback setter that is called when P2P started based on Room. The callback is called with the following arguments: - success: whether the P2P was started successfully
[IMPORTANT] This callback is just to check if the request is accepted by the server
To handle the P2P information pushed by the server, use p2p.OnStartP2PSync This is because the packet format for Push is shared between Room and MatchMaker.
func (*Room) OnPropGetResponse
func (room *Room) OnPropGetResponse(callback func(success bool, props [][]byte))
OnPropGetResponse assigns a callback on get property event response
func (*Room) OnPropIncrPush
func (room *Room) OnPropIncrPush(callback func(success bool, key string, numProps uint64))
OnPropIncrPush assigns a callback on property incr event push
func (*Room) OnPropIncrResponse
func (room *Room) OnPropIncrResponse(callback func(success bool, numProps int64))
OnPropIncrResponse assigns a callback on property incr event response
func (*Room) OnPropSyncResponse
func (room *Room) OnPropSyncResponse(callback func(success bool, props map[string][]byte))
OnPropSyncResponse assigns a callback on sync properties event
func (*Room) OnPropUpdatePush
func (room *Room) OnPropUpdatePush(callback func(rops map[string][]byte))
OnPropUpdatePush assigns a callback on property update event push
func (*Room) OnPropUpdateResponse
func (room *Room) OnPropUpdateResponse(callback func(success bool))
OnPropUpdateResponse assigns a callback on get property event response
func (*Room) OnRegister
func (room *Room) OnRegister(callback func(success bool, msg []byte))
OnRegister is a callback setter that is called when a room is created The callback is called with the following arguments: - success: whether the room was created successfully - msg: Error message byte array if success was false.
func (*Room) OnRelayProfilePush
func (room *Room) OnRelayProfilePush(callback func(msg []byte))
OnRelayProfilePush assigns a callback on relay profile push event
func (*Room) OnRelayProfileResponse
func (room *Room) OnRelayProfileResponse(callback func(success bool, msg []byte))
OnRelayProfileResponse assigns a callback on relay profile response event
func (*Room) OnRelayPush
func (room *Room) OnRelayPush(callback func(msg []byte))
OnRelayPush assigns a callback on relay push event
func (*Room) OnRelayResponse
func (room *Room) OnRelayResponse(callback func(success bool, msg []byte))
OnRelayResponse assigns a callback on relay response event
func (*Room) OnRelayToProfilePush
func (room *Room) OnRelayToProfilePush(callback func(msg []byte))
OnRelayToProfilePush assigns a callback on relay to profile push event
func (*Room) OnRelayToProfileResponse
func (room *Room) OnRelayToProfileResponse(callback func(success bool, msg []byte))
OnRelayToProfileResponse assigns a callback on relay to profile response event
func (*Room) OnRelayToPush
func (room *Room) OnRelayToPush(callback func(msg []byte))
OnRelayToPush assigns a callback on relay to push event
func (*Room) OnRelayToResponse
func (room *Room) OnRelayToResponse(callback func(success bool, msg []byte))
OnRelayToResponse assigns a callback on relay to response event
func (*Room) OnReserve
func (room *Room) OnReserve(callback func(success bool, msg []byte))
OnReserve assigns a callback on reserve event
func (*Room) OnRoomOwnerChange
func (room *Room) OnRoomOwnerChange(callback func(message []byte))
OnRoomOwnerChange is a callback setter that is called when the owner of the room changes. The callback is called with the following arguments: - roomID: the new ID of the room
func (*Room) OnStartP2PSyncDoNotUse
func (room *Room) OnStartP2PSyncDoNotUse()
OnStartP2PSyncDoNotUse does nothing. You will be happy with p2p.OnStartP2PSync
func (*Room) OnTransferOwnershipResponse
func (room *Room) OnTransferOwnershipResponse(callback func(bool))
OnTransferOwnershipResponse is a callback setter that is called when a room's ownership transfer response is received. The callback is called with the following argument: - success: whether the ownership transfer was successful
func (*Room) Register
func (room *Room) Register(roomType int, roomName string, roomMetadata string)
Register a room (the client is already a member of) with a type (used by FindRoomsByType). OnRegister is called when the room is registered. Register registers a room with the given parameters - roomType: the type of the room - roomName: the name of the room - roomMetadata: Extra string data for the room registered.
func (*Room) Relay
func (room *Room) Relay(message []byte, reliable bool)
Relay sends a message to a room
func (*Room) RelayProfile
func (room *Room) RelayProfile(message []byte, reliable bool)
RelayProfile sends a message to a room
func (*Room) RelayTo
func (room *Room) RelayTo(memberIDs []string, message []byte, reliable bool)
RelayTo sends a message to a room memebers
func (*Room) RelayToProfile
func (room *Room) RelayToProfile(memberIDs []string, message []byte, reliable bool)
RelayToProfile sends a message to a room memebers
func (*Room) Reserve
func (room *Room) Reserve(userIDs []string)
Reserve reserves a room
func (*Room) SetupAsTCP
func (room *Room) SetupAsTCP(tcpClient *tcp.Client) bool
SetupAsTCP sets up Room client as TCP client
func (*Room) SetupAsUDP
func (room *Room) SetupAsUDP(udpClient *udp.Client) bool
SetupAsUDP sets up Room client as UDP client
func (*Room) SetupOnJoinEvent
func (room *Room) SetupOnJoinEvent(ver uint8, cmd uint16)
SetupOnJoinEvent has been deprecated
func (*Room) SetupOnOffline
func (room *Room) SetupOnOffline(callback func())
SetupOnOffline registers a callback which is triggered when server goes offline state
func (*Room) StartP2PSync
func (room *Room) StartP2PSync(clients uint8)
StartP2PSync Starts peer-to-peer communications with the remote clients in the same room. This method raises OnStartP2PSync event. Params: - clients: Number of clients to be linked directly via peer-to-peer.Other remote clients in the room will be linked via relay.
func (*Room) SyncProperties
func (room *Room) SyncProperties()
SyncProperties etrieve properties of the room.
Raises OnPropertySync event.
Only properties with byte array value will be synchronized.
func (*Room) TransferOwnership
func (room *Room) TransferOwnership(roomID string, newOwnerUID string)
TransferOwnership transfers ownership of the room with the given room ID to the provided UID. If the new owner's UID is empty, a random room member will be selected. This corresponds to the JSON definition for TransferOwnership:
- roomID: Room ID of the room to transfer ownership of. NOTE: You must be the owner of this Room.
- newOwnerUID: UID of the new owner of the Room. Leave blank to select random Room member.
func (*Room) UpdateObject
func (room *Room) UpdateObject(mode byte, name string, obj map[string]float64, reliable bool)
UpdateObject updates a room object by the given properties. mode: UpdateObjectIncrMode, UpdateObjectSetMode, UpdateObjectDelMode
func (*Room) UpdateProperty
func (room *Room) UpdateProperty(props map[string][]byte, sync bool)
UpdateProperty updates properties of the room.