Introduction:
This article concerns the Vivox Core SDK requests vx_req_connector_create and vx_req_connector_initiate_shutdown. When using the 'vivoxclientsdk' C++ Core library wrapper, these requests are issued by calling ClientConnection::Connect
and ClientConnection::Disconnect
. There are no equivalent calls in the Vivox Unity package or Vivox Unreal plugin. For easier reference in this article, these requests/calls will be shortened to just Connect
and Disconnect
.
The Vivox SDK calls Connect
and Disconnect
are often misunderstood due to their non-intuitive nature. In order to use these calls effectively, it's crucial to understand that the Connect
call does not establish a persistent connection to the Vivox backend that needs to be maintained while using the service.
The Connect Call:
The Connect
call is essentially a one-time HTTP request that contacts the Vivox network and downloads configuration information to the client relevant to your game's communications infrastructure [1]. This configuration information, essentially a config file of server info, is loaded into memory before the Login
operation. This is why you don't need to call Connect
again after losing a network connection, and can simply proceed to Login
.
Being "Connected" does not hold open any ports, use bandwidth, network resources, or CPU for heartbeats, etc., and only requires a small amount of memory to hold the config.
The Disconnect Call:
The Disconnect
call simply unloads this config file from memory. Therefore, it's never necessary to call Disconnect
unless you actually intend to switch which Vivox backend you connect to after the initial connection. Circumstances requiring this are exceedingly rare.
Conclusion:
In summary, the Connect
call is used in Vivox Core implementations to fetch the server configuration information necessary for your game to Login
and use Vivox, and the Disconnect
call is used to unload this information from memory. Connect
is usually only called once per application startup before the first Login
, and Disconnect
is usually never called. Uninitialize
can instead be called once on application exit in order to clean up Vivox resources. Understanding these calls is crucial for effectively utilizing the Vivox SDK in your game development process.