Skip to main content

Minimal Command Line Client

We have a full working example of a minimal ODIN client in C, which demonstrates how to connect to an ODIN room and exchange voice data with other peers. The example is built using the miniaudio library for cross-platform audio capture and playback.

info

Please note, that the configure process will try to download, verify and extract dependencies ( e.g. miniaudio), which are specified in the CMakeLists.txt file. miniaudio is used to provide basic audio capture and playback functionality in the test client.

The example is located in the test directory of the ODIN SDK repository. To build and run the example, follow the instructions below.

Clone the Repository

To get started, clone the repository and navigate to the test directory:

git clone https://github.com/4Players/odin-sdk.git odin-sdk
cd odin-sdk/test

Configuring and Building

  1. Create a build directory:
    mkdir -p build && cd build

  2. Generate build scripts for your preferred build system:

    • For make ...
      cmake ../
    • ... or for ninja ...
      cmake -GNinja ../
  3. Build the test client:

    • Using make ...
      make
    • ... or ninja ...
      ninja

On Windows, calling cmake from the build directory will create a Visual Studio solution, which can be built using the following command:

msbuild odin_minimal.sln

Using the Test Client

The test client accepts several arguments to control its functions, but the following three options are particularly crucial for its intended purpose:

odin_minimal -r <room_id> -k <access_key> -s <server_url>

The -r argument (or --room-id) is used to specify the name of the room to join. If no room name is provided, the client will automatically join a room called default.

The -k argument (or --access-key) is used to specify an access key for generating tokens. If no access key is provided, the test client will auto-generate a key and display it in the console. An access key is a unique authentication key used to generate room tokens for accessing the 4Players ODIN server network. It is important to use the same access key for all clients that wish to join the same ODIN room. For more information about access keys, please refer to our documentation.

The -s argument (or --server-url) allows you to specify an alternate ODIN server address. This address can be either the URL to an ODIN gateway or an ODIN server. You may need to specify an alternate server if you are hosting your own fleet of ODIN servers. If you do not specify an ODIN server URL, the test client will use the default gateway, which is located at https://gateway.odin.4players.io.

Note: You can use the --help argument to get a full list of options provided by the console client.