Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
ConnectOptions Class Reference
Inheritance diagram for ConnectOptions:
Inheritance graph
[legend]
Collaboration diagram for ConnectOptions:
Collaboration graph
[legend]

Public Member Functions

 ConnectOptions (const AuthenticationValues &authenticationValues=AuthenticationValues(), const Common::JString &username=L"", const Common::JString &serverAddress=M_NAMESERVER, nByte serverType=ServerType::NAME_SERVER, bool tryUseDatagramEncryption=false)
 
 ~ConnectOptions (void)
 
 ConnectOptions (const ConnectOptions &toCopy)
 
ConnectOptionsoperator= (const ConnectOptions &toCopy)
 
const AuthenticationValuesgetAuthenticationValues (void) const
 
ConnectOptionssetAuthenticationValues (const AuthenticationValues &authenticationValues)
 
const Common::JStringgetUsername (void) const
 
ConnectOptionssetUsername (const Common::JString &username)
 
const Common::JStringgetServerAddress (void) const
 
ConnectOptionssetServerAddress (const Common::JString &serverAddress)
 
nByte getServerType (void) const
 
ConnectOptionssetServerType (nByte serverType)
 
bool getTryUseDatagramEncryption (void) const
 
ConnectOptionssetTryUseDatagramEncryption (bool tryUseDatagramEncryption)
 
virtual Common::JStringtoString (Common::JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const=0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Detailed Description

This class aggregates the various optional parameters that can be passed to Client::connect().

See also
Client::connect()

Constructor & Destructor Documentation

◆ ConnectOptions() [1/2]

ConnectOptions ( const AuthenticationValues authenticationValues = AuthenticationValues(),
const Common::JString username = L"",
const Common::JString serverAddress = M_NAMESERVER,
nByte  serverType = ServerType::NAME_SERVER,
bool  tryUseDatagramEncryption = false 
)

Constructor: Creates a new instance with the specified parameters.

Note
on XBox consoles the value of parameter 'tryUseDatagramEncryption' is ignored and the client always behaves as if it was 'true'.
Parameters
authenticationValuesAn instance of class AuthenticationValues - optional, defaults to a default-constructed AuthenticationValues instance.
usernameThe users display name as shown to other users - not to be confused with the users unique ID for identification and authentication purposes, which is part of the AuthenticationValues - optional, defaults to an empty string.
serverAddressA null terminated string containing the IP address or domain name and optionally the port number to connect to. IP addresses can be in IPv4 or IPv6 format, examples: L"192.168.0.1", L"192.168.0.1:5055", L"udp.gameserver.com", L"udp.gameserver.com:5055", L"[2002:C0A8:1::]", L"[2002:C0A8:1::]:5055". Note that IPv6 addresses must include square brackets to indicate where the address itself ends and the port begins. If no port is given, then the default port for the chosen protocol and server type will be used. - optional, defaults to the address of Photon Cloud.
serverTypeOne of the values in ServerType. Must match the type of the Photon server that is reachable at the given address and port. Should be ServerType::NAME_SERVER for the Photon Cloud and for self-hosted Photon 5 or higher Server instances and ServerType::MASTER_SERVER for self-hosted Photon 4 Server instances. You should NOT directly pass the address of a regions master server with Photon Cloud or with Photon 5 Server and up, but you should always connect to the name server when you connect to Photon Cloud or to Photon 5 Server and up. - optional, defaults to ServerType::NAME_SERVER.
tryUseDatagramEncryptiondefaults to 'false'. Setting this to 'true' results in encryption-key exchange via an initial WSS-connection and in all UDP traffic getting encrypted, if all of the following is true: the argument for 'serverType' is ServerType::NAME_SERVER, the connection protocol specified in the constructor is ConnectionProtocol::UDP, the Photon Client for the platform supports UDP encryption and the Photon client for the platform supports ConnectionProtocol::WSS. If any of these conditions is false, then the value of this parameter is ignored and the client behaves as if it was 'false'. - optional defaults to false.

◆ ~ConnectOptions()

~ConnectOptions ( void  )

Destructor.

◆ ConnectOptions() [2/2]

ConnectOptions ( const ConnectOptions toCopy)

Copy-Constructor: Creates a new instance that is a deep copy of the argument instance.

Parameters
toCopyThe instance to copy.

Member Function Documentation

◆ operator=()

ConnectOptions & operator= ( const ConnectOptions toCopy)

operator=.

Makes a deep copy of its right operand into its left operand.

This overwrites old data in the left operand.

◆ getAuthenticationValues()

const AuthenticationValues & getAuthenticationValues ( void  ) const

◆ setAuthenticationValues()

ConnectOptions & setAuthenticationValues ( const AuthenticationValues authenticationValues)

Sets the AuthenticationValues.

Please see AuthenticationValues for further information.

Parameters
authenticationValuesAn instance of class AuthenticationValues.
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getAuthenticationValues(), AuthenticationValues

◆ getUsername()

const JString & getUsername ( void  ) const
Returns
the currently set user name
See also
setUsername()

◆ setUsername()

ConnectOptions & setUsername ( const Common::JString username)

Sets the user name.

Please see AuthenticationValues for further information.

Parameters
usernameThe users display name as shown to other users - not to be confused with the users unique ID for identification and authentication purposes, which is part of the AuthenticationValues.
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getUsername()

◆ getServerAddress()

const JString & getServerAddress ( void  ) const
Returns
the currently set server address
See also
setServerAddress()

◆ setServerAddress()

ConnectOptions & setServerAddress ( const Common::JString serverAddress)

Sets the server address.

Parameters
serverAddressA null terminated string containing the IP address or domain name and optionally the port number to connect to. IP addresses can be in IPv4 or IPv6 format, examples: L"192.168.0.1", L"192.168.0.1:5055", L"udp.gameserver.com", L"udp.gameserver.com:5055", L"[2002:C0A8:1::]", L"[2002:C0A8:1::]:5055". Note that IPv6 addresses must include square brackets to indicate where the address itself ends and the port begins. If no port is given, then the default port for the chosen protocol and server type will be used. Defaults to the address of Photon Cloud.
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getServerAddress()

◆ getServerType()

nByte getServerType ( void  ) const
Returns
the currently set ServerType
See also
setServerType(), ServerType

◆ setServerType()

ConnectOptions & setServerType ( nByte  serverType)

Sets the ServerType.

Parameters
serverTypeOne of the values in ServerType. Must match the type of the Photon server that is reachable at the given address and port. Should be ServerType::NAME_SERVER for the Photon Cloud and for self-hosted Photon 5 or higher Server instances and ServerType::MASTER_SERVER for self-hosted Photon 4 Server instances. You should NOT directly pass the address of a regions master server with Photon Cloud or with Photon 5 Server, but you should always connect to the name server when you connect to Photon Cloud or to Photon 5 Server and up.
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getServerType(), ServerType

◆ getTryUseDatagramEncryption()

bool getTryUseDatagramEncryption ( void  ) const
Returns
the currently set value for the tryUseDatagramEncryption flag
See also
setServerType()

◆ setTryUseDatagramEncryption()

ConnectOptions & setTryUseDatagramEncryption ( bool  tryUseDatagramEncryption)

Sets the value for the tryUseDatagramEncryption flag.

Note
on XBox consoles the value of parameter 'tryUseDatagramEncryption' is ignored and the client always behaves as if it was 'true'.
Parameters
tryUseDatagramEncryptiondefaults to 'false'. Setting this to 'true' results in encryption-key exchange via an initial WSS-connection and in all UDP traffic getting encrypted, if all of the following is true: the argument for 'serverType' is ServerType::NAME_SERVER, the connection protocol specified in the constructor is ConnectionProtocol::UDP, the Photon Client for the platform supports UDP encryption and the Photon client for the platform supports ConnectionProtocol::WSS. If any of these conditions is false, then the value of this parameter is ignored and the client behaves as if it was 'false'.
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getTryUseDatagramEncryption()

◆ toString() [1/3]

JString & toString ( Common::JString retStr,
bool  withTypes = false 
) const
virtual
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.

◆ toString() [2/3]

toString
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

◆ toString() [3/3]

JString toString

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.
See also
JString