Configuration

The ServerConfig.xml is the main configuration file of FigNet. It is located at the root level of binaries-folder. It is used to setup common application properties and server socket and client socket

Common Attributes

<?xml version="1.0" encoding="utf-16"?>
<Configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!--Avaliable Providers TCP, ENet, LiteNetLib, WebSockets-->
    <ApplicationType>Server</ApplicationType>
    <FrameRate>60</FrameRate>
    <EnableFileLogs>false</EnableFileLogs>
    <LoggingLevel>INFO</LoggingLevel><!--NONE, INFO, DEBUG, ALL-->
    <AppSecretKey>123</AppSecretKey>
    <EncryptionKey>MbQeThWmZq4t6w</EncryptionKey>
<!--Here add Modules-->
<!--Here add Server Socket Listner-->
<!--Here add Client Socket Listners-->
<!--Here add SubscribeDebugMessages-->
</Configuration>

ApplicationType: Server|Client, Weather you are running your app as server or client.

FrameRate: Tick rate of Network service function

EnableFileLogs: true|false, if set to false logs will be printed on console and if set to true logs will be printed in log file placed under logs/fileName.log it is placed next to executable.

LoggingLevel: NONE|INFO|DEBUG|ALL (should be in caps)

  • NONE: no logs will be printed

  • INFO: only basic messages will be printed e.g. Connection Started, Peer Connected & Disconnected etc.

  • DEBUG: it prints info of all incoming & outgoing message of Sockets

  • ALL: same as DEBUG + it prints content of incoming & outgoing traffic

*for more details see Logging

Logging

AppSecretKey: A secret key that is used to authenticate users, if a connecting client is not providing correct key it will be disconnected by sever.

EncryptionKey: FigNet has optional encryption that can be enabled per message and key used to encrypt the message [needs to be same on both ends, server & client side]

Modules Node

AssemblyName: Name of DLL/Solution

Type: Name of class including namespace

Package: additional dependency your module depends on

For more details read Modules session

Modules

Server Config Node

Name: A descriptive name that can be used to query config instance

Port: Port number at which the server will listen for connections

Provider: Underneath Transport layer, available transports are [ LiteNetLib, ENet, TCP, WS ]

MaxChannels: Max Channels, applicable to LiteNetLib & ENet

MaxConnections: Max Allowed connections, applicable to LiteNetLib & ENet

DisconnectTimeout: in milli seconds, If Server doesn't hear from clients after this time a timeout disconnect will be fired [ applicable to LiteNetLib & ENet ]

EnableCheckSum: It adds additional 4 bytes to every network message & provides protection to data corruptions, *this property needs to be same on both sides client & server.

MaxSendQueueSize: Every out-going message gets queued into this Queue till Networking process function serialize it dispatches it. If this queue gets filled oldest messages in the queue will be dropped.

MaxReceiveQueueSize: Every in-coming message gets queued into this queue till networking process function De-serialize it and trigger the network message received event. If this queue gets filled oldest messages in the queue will be dropped.

IsMultiThreaded: If set to true, Networking will be done on separate thread [but on Network Receive events will be received on main thread because unity doesn't allows to call unity's object access from different threads ]

EnableDebugMessages: It enabled the internal logs of transport library, useful for debugging. Applicable to TCP & WebSockets only.

Peers[client] Config Node

Name: A Descriptive name to access the config instance.

Port: Port number to connect to.

PeerIp: Ip of the Server.

Provider: Underneath Transport layer, available transports are [ LiteNetLib, ENet, TCP, WS ], Server and Client have to have same provider to establish connect.

AutoConnect: On App launch client automatically initiated the connection request

MaxChannels: Max Channels, applicable to LiteNetLib & ENet

DisconnectTimeout: in milli seconds, If Client doesn't hear from server, after this time a timeout disconnect will be fired [ applicable to LiteNetLib & ENet ]

EnableCheckSum: It adds additional 4 bytes to every network message & provides protection to data corruptions, this property needs to be same on both sides client & server.

MaxSendQueueSize: Every out-going message gets queued into this Queue till Networking process function serialize it dispatches it. If this queue gets filled oldest messages in the queue will be dropped

MaxReceiveQueueSize: Every in-coming message gets queued into this queue till networking process function De-serialize it and trigger the network message received event. If this queue gets filled oldest messages in the queue will be dropped

IsMultiThreaded: If set to true, Networking will be done on separate thread [but on Network Receive events will be received on main thread because unity doesn't allows to call unity's object access from different threads ]

Peers[client] Config Unity Editor Window

FigNet/Settings

ServerConfig Unity Editor Window

SubscribeDebugMessages Node

Id: Id of message that you wants to inspect

*Note: this node is optional. When LoggingLevel in common settings is set to ALL it logs detailed info of every incoming & outgoing message. That can become overwhelming if server is receiving lots of message. Adding MessageInfo in SubscribeDebugMessages Node will log detailed info of subscribed message.

Last updated

Was this helpful?