|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Holds all the settings for the connection. More...
#include <ConfigData.h>
Classes | |
| struct | BlueBoxCfg |
| Settings of the HTTP tunnel (BlueBox), used when a TCP connection cannot be established. More... | |
Public Member Functions | |
| void | load (std::string filePath) |
| Loads the settings from an external file. | |
| void | parse (std::vector< std::string > lines) |
| Reads the settings from lines of text that were already loaded. | |
| std::string | toString () |
Public Attributes | |
| std::string | host = "127.0.0.1" |
| The host to connect to. | |
| int | port = 9977 |
| The TCP port used for the connection. | |
| int | udpPort = 9977 |
| The UDP port used for a UDP connection. | |
| int | httpPort = 8088 |
| The HTTP port to be used for HTTP calls. | |
| int | httpsPort = 8843 |
| The HTTPS port to be used for HTTP calls. | |
| int | tcpConnectionTimeout = 2000 |
| The amount of time (in milliseconds) after which the client should give up if there's no response from the server side. | |
| std::string | zone = "" |
| The name of the Zone to connect to. | |
| core::NetDebugLevel | netDebugLevel = core::NetDebugLevel::Off |
| Debug settings to show more information about the data exchange between client and server: | |
| BlueBoxCfg | blueBox |
| Settings to configure the HTTP tunnel, used when a TCP connection cannot be established. | |
| bool | useSSL = false |
| Enables protocol encryption. | |
| bool | allowUnsafeSSL = false |
| Allows to test locally with the default, self-signed SSL/TLS certificate, skipping the validation of the certificate. | |
| bool | useTcpFallback = false |
| When sending data via UDP, if the UDP connection failed, it will use TCP instead. | |
| bool | threadSafeMode = true |
| Instructs the API to run with an event queue that must be processed by the client, by calling SmartFox::processEvents. | |
Holds all the settings for the connection.
It must be passed to the SmartFox class to start a connection to the server.
| void sfs3::ConfigData::load | ( | std::string | filePath | ) |
Loads the settings from an external file.
Every line of the file must contain a property name and a value, like this:
# My Test Config host = mygame.online port = 9999 blueBox.isActive = true
The property name is the same as the field name in this class. A line that starts with the '#' symbol is a comment and it is ignored. If the file cannot be read, the settings keep their current values.
| filePath | the path of the file to read |
| void sfs3::ConfigData::parse | ( | std::vector< std::string > | lines | ) |
Reads the settings from lines of text that were already loaded.
The lines use the same format as the file read by ConfigData::load.
| lines | the lines of text to read |
| std::string sfs3::ConfigData::toString | ( | ) |
| core::NetDebugLevel sfs3::ConfigData::netDebugLevel = core::NetDebugLevel::Off |
Debug settings to show more information about the data exchange between client and server:
| bool sfs3::ConfigData::useSSL = false |
Enables protocol encryption.
This requires that the server is configured accordingly and a valid SSL/TLS certificate is installed. For more details check the online documentation, under Getting Started > Configuring TLS/SSL
| bool sfs3::ConfigData::threadSafeMode = true |
Instructs the API to run with an event queue that must be processed by the client, by calling SmartFox::processEvents.
This approach is useful when working in a game engine's main loop, where you are not allowed to touch game objects from threads other than the game's main thread.
Default value is true. We recommend keeping it on when working with a single threaded game loop.