A LoadbalancingPeer provides the operations and enum definitions needed to use the loadbalancing server application which is also used in Photon Cloud. More...
Inherits PhotonPeer.
Public Member Functions | |
LoadBalancingPeer (ConnectionProtocol protocolType) | |
Creates a Peer with specified connection protocol. You need to set the Listener before using the peer. More... | |
LoadBalancingPeer (IPhotonPeerListener listener, ConnectionProtocol protocolType) | |
Creates a Peer with specified connection protocol and a Listener for callbacks. More... | |
virtual bool | OpGetRegions (string appId) |
virtual bool | OpJoinLobby (TypedLobby lobby=null) |
Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpLeaveLobby () |
Leaves the lobby on the Master Server. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpCreateRoom (EnterRoomParams opParams) |
Creates a room (on either Master or Game Server). The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpJoinRoom (EnterRoomParams opParams) |
Joins a room by name or creates new room if room with given name not exists. The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpJoinRandomRoom (OpJoinRandomRoomParams opJoinRandomRoomParams) |
Operation to join a random, available room. Overloads take additional player properties. This is an async request which triggers a OnOperationResponse() call. If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound. If successful, the OperationResponse contains a gameserver address and the name of some room. More... | |
virtual bool | OpLeaveRoom (bool becomeInactive, bool sendAuthCookie=false) |
Leaves a room with option to come back later or "for good". More... | |
virtual bool | OpGetGameList (TypedLobby lobby, string queryData) |
Gets a list of games matching a SQL-like where clause. More... | |
virtual bool | OpFindFriends (string[] friendsToFind) |
Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate). More... | |
bool | OpSetCustomPropertiesOfActor (int actorNr, Hashtable actorProperties) |
bool | OpSetCustomPropertiesOfRoom (Hashtable gameProperties) |
virtual bool | OpAuthenticate (string appId, string appVersion, AuthenticationValues authValues, string regionCode, bool getLobbyStatistics) |
Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpAuthenticateOnce (string appId, string appVersion, AuthenticationValues authValues, string regionCode, EncryptionMode encryptionMode, ConnectionProtocol expectedProtocol) |
Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call. More... | |
virtual bool | OpChangeGroups (byte[] groupsToRemove, byte[] groupsToAdd) |
Operation to handle this client's interest groups (for events in room). More... | |
virtual bool | OpRaiseEvent (byte eventCode, object customEventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions) |
Send an event with custom code/type and any content to the other players in the same room. More... | |
virtual bool | OpSettings (bool receiveLobbyStats) |
Internally used operation to set some "per server" settings. This is for the Master Server. More... | |
Protected Member Functions | |
void | OpSetPropertyOfRoom (byte propCode, object value) |
A LoadbalancingPeer provides the operations and enum definitions needed to use the loadbalancing server application which is also used in Photon Cloud.
Internally used by PUN. The LoadBalancingPeer does not keep a state, instead this is done by a LoadBalancingClient.
LoadBalancingPeer | ( | ConnectionProtocol | protocolType | ) |
Creates a Peer with specified connection protocol. You need to set the Listener before using the peer.
Each connection protocol has it's own default networking ports for Photon.
protocolType | The preferred option is UDP. |
LoadBalancingPeer | ( | IPhotonPeerListener | listener, |
ConnectionProtocol | protocolType | ||
) |
Creates a Peer with specified connection protocol and a Listener for callbacks.
|
virtual |
Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
appId | Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage). |
appVersion | The client's version (clients with differing client appVersions are separated and players don't meet). |
authValues | Contains all values relevant for authentication. Even without account system (external Custom Auth), the clients are allowed to identify themselves. |
regionCode | Optional region code, if the client should connect to a specific Photon Cloud Region. |
getLobbyStatistics | Set to true on Master Server to receive "Lobby Statistics" events. |
|
virtual |
Sends this app's appId and appVersion to identify this application server side. This is an async request which triggers a OnOperationResponse() call.
This operation makes use of encryption, if that is established before. See: EstablishEncryption(). Check encryption with IsEncryptionAvailable. This operation is allowed only once per connection (multiple calls will have ErrorCode != Ok).
appId | Your application's name or ID to authenticate. This is assigned by Photon Cloud (webpage). |
appVersion | The client's version (clients with differing client appVersions are separated and players don't meet). |
authValues | Optional authentication values. The client can set no values or a UserId or some parameters for Custom Authentication by a server. |
regionCode | Optional region code, if the client should connect to a specific Photon Cloud Region. |
encryptionMode | |
expectedProtocol |
|
virtual |
Operation to handle this client's interest groups (for events in room).
Note the difference between passing null and byte[0]: null won't add/remove any groups. byte[0] will add/remove all (existing) groups. First, removing groups is executed. This way, you could leave all groups and join only the ones provided.
Changes become active not immediately but when the server executes this operation (approximately RTT/2).
groupsToRemove | Groups to remove from interest. Null will not remove any. A byte[0] will remove all. |
groupsToAdd | Groups to add to interest. Null will not add any. A byte[0] will add all current. |
|
virtual |
Creates a room (on either Master or Game Server). The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.
If the room is already existing, the OperationResponse will have a returnCode of ErrorCode.GameAlreadyExists.
|
virtual |
Request the rooms and online status for a list of friends (each client must set a unique username via OpAuthenticate).
Used on Master Server to find the rooms played by a selected list of users. Users identify themselves by using OpAuthenticate with a unique username. The list of usernames must be fetched from some other source (not provided by Photon).
The server response includes 2 arrays of info (each index matching a friend from the request): ParameterCode.FindFriendsResponseOnlineList = bool[] of online states ParameterCode.FindFriendsResponseRoomIdList = string[] of room names (empty string if not in a room)
friendsToFind | Array of friend's names (make sure they are unique). |
|
virtual |
Gets a list of games matching a SQL-like where clause.
Operation is only available in lobbies of type SqlLobby. This is an async request which triggers a OnOperationResponse() call. Returned game list is stored in RoomInfoList.
https://doc.photonengine.com/en-us/realtime/current/reference/matchmaking-and-lobby::sql_lobby_type
lobby | The lobby to query. Has to be of type SqlLobby. |
queryData | The sql query statement. |
|
virtual |
Joins the lobby on the Master Server, where you get a list of RoomInfos of currently open rooms. This is an async request which triggers a OnOperationResponse() call.
lobby | The lobby join to. |
|
virtual |
Operation to join a random, available room. Overloads take additional player properties. This is an async request which triggers a OnOperationResponse() call. If all rooms are closed or full, the OperationResponse will have a returnCode of ErrorCode.NoRandomMatchFound. If successful, the OperationResponse contains a gameserver address and the name of some room.
|
virtual |
Joins a room by name or creates new room if room with given name not exists. The OperationResponse depends on the server the peer is connected to: Master will return a Game Server to connect to. Game Server will return the joined Room's data. This is an async request which triggers a OnOperationResponse() call.
If the room is not existing (anymore), the OperationResponse will have a returnCode of ErrorCode.GameDoesNotExist. Other possible ErrorCodes are: GameClosed, GameFull.
|
virtual |
Leaves the lobby on the Master Server. This is an async request which triggers a OnOperationResponse() call.
|
virtual |
Leaves a room with option to come back later or "for good".
becomeInactive | Async games can be re-joined (loaded) later on. Set to false, if you want to abandon a game entirely. |
sendAuthCookie | WebFlag: Securely transmit the encrypted object AuthCookie to the web service in PathLeave webhook when available |
|
virtual |
Send an event with custom code/type and any content to the other players in the same room.
This override explicitly uses another parameter order to not mix it up with the implementation for Hashtable only.
eventCode | Identifies this type of event (and the content). Your game's event codes can start with 0. |
customEventContent | Any serializable datatype (including Hashtable like the other OpRaiseEvent overloads). |
raiseEventOptions | Contains (slightly) less often used options. If you pass null, the default options will be used. |
sendOptions | Send options for reliable, encryption etc |
|
virtual |
Internally used operation to set some "per server" settings. This is for the Master Server.
receiveLobbyStats | Set to true, to get Lobby Statistics (lists of existing lobbies). |