The OpenTok Server Rust SDK wraps the OpenTok REST API. It lets developers securely create sessions and generate tokens for their applications that use the Vonage Video API. Developers can also use the server SDK to work with OpenTok archives. Use it in conjunction with the OpenTok client SDK.
let api_key = env::var("OPENTOK_KEY").unwrap();
let api_secret = env::var("OPENTOK_SECRET").unwrap();
let opentok = OpenTok::new(api_key, api_secret);
let session_id = opentok.create_session(SessionOptions::default()).await;
let token = opentok.generate_token(session_id, TokenRole::Publisher);
The tests expect a working network connection and the following environment variables defined:
export OPENTOK_KEY=<your-opentok-api-key>
export OPENTOK_SECRET=<your-opentok-api-secret>
The tests make use of the OpenTok client SDK, so you'll need to install its dependencies, starting with the OpenTok Linux SDK:
wget https://tokbox.com/downloads/libopentok_linux_llvm_x86_64-2.19.1
tar xvf libopentok_linux_llvm_x86_64-2.19.1 -C /home/quijote/opentok
export LD_LIBRARY_PATH="/home/quijote/opentok/libopentok_linux_llvm_x86_64-2.19.1/lib:$LD_LIBRARY_PATH"
export LIBRARY_PATH="/home/quijote/opentok/libopentok_linux_llvm_x86_64-2.19.1/lib:$LIBRARY_PATH"
GStreamer is also required:
sudo apt -y install libgstreamer-plugins-base1.0-dev