This message was deleted.
# sdk-rust
s
This message was deleted.
b
Hey looks like you ran out of memory? Can you try the command below to see if it helps:
Copy code
cargo run --release --verbose --jobs 1
b
root@ip-172-31-15-241:/usr/src/client-sdk-rust# cargo run --release --verbose --jobs 1 error: a bin target must be available for
cargo run
root@ip-172-31-15-241:/usr/src/client-sdk-rust#
b
Oh nvm, replace
run
by
build
Maybe do a
cargo clean
before
b
Ok trying
👍 1
e
If you could post the full logs that would be helpful - it may be a missing dependency
b
b
Seems better now, can you install these dependencies:
Copy code
sudo apt update -y
sudo apt install -y libssl-dev libx11-dev libgl1-mesa-dev libxext-dev
b
Ok doing now
Just done, now going to execute cargo build again
Executed cargo build --release --verbose --jobs 1 command
now waiting for output
Installed
Now running this command: rustc examples/basic_room/src/main.rs --edition 2021
but getting errors
e
To build the basic_room example you should change your working directory to the basic_room directory and run ‘cargo build’
👍 1
🙏 1
b
oh ok
let me try
b
Did it work? I’ll include the dependencies on the readme, it’ll help other people
b
Allow me few mins please. My server harddisk got full. Trying on another server quickly.
👌 1
Packages are installed in basic_room folder and now when we are running cargo run src/main.rs I can see many warnings https://pastebin.com/zCeGSMSY
b
I guess you can ignore these warnings, they’re coming from libwebrtc, and only shown when compiling on debian systems. They’re also there on other platforms but they’re hidden
b
Ok
Is there any documentation on how to define Env variables for Rust SDK?
b
You can just export them on your current env:
export LIVEKIT_URL=<ws://localhost:7880>
export LIVEKIT_TOKEN=<your_token>
(But this is only for the basic_room example, so there is no documentation, this is more like a code example you can look into)
b
Okk
Finished dev [unoptimized + debuginfo] target(s) in 14.11s     Running
/var/www/html/lkc-rust/examples/target/debug/basic_room src/main.rs
thread 'main' panicked at 'called
Result::unwrap()
on an
Err
value: Engine(Signal(Client(401, "invalid API key")))', basic_room/src/main.rs1910 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace
b
Seems like your token provided by LIVEKIT_TOKEN is not valid. It is using an API_KEY that is unrecognised by the livekit server
b
We need to generate LIVEKIT_TOKEN each time when try to connect to the room. Is that right?
b
Not necessarily, it depends on the expiration time of the jwt token
b
Okk
Now getting this: Finished dev [unoptimized + debuginfo] target(s) in 13.54s Running
/var/www/html/lkc-rust/examples/target/debug/basic_room src/main.rs RUST_BACKTRACE=1
thread ‘main’ panicked at ‘called
Result::unwrap()
on an
Err
value: Engine(Signal(WsError(Url(TlsFeatureNotEnabled))))’, basic_room/src/main.rs2010 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace
b
TLS is not enabled by default because the selected feature depends on the platform, on Debian, you can simply use
native-tls
examples/basic_room/Cargo.toml
Copy code
diff --git a/examples/basic_room/Cargo.toml b/examples/basic_room/Cargo.toml
index b80f9c5..e02f859 100644
--- a/examples/basic_room/Cargo.toml
+++ b/examples/basic_room/Cargo.toml
@@ -6,5 +6,5 @@ edition = "2021"
 [dependencies]
 tokio = { version = "1", features = ["full"] }
 env_logger = "0.10"
-livekit = { path = "../../livekit", version = "0.1.3" }
+livekit = { path = "../../livekit", version = "0.1.3", features = ["native-tls"]}
 log = "0.4"
b
@boundless-energy-78552 which os do you prefer to run Rust sdk?
b
No preference, it is meant to be cross platform and to work everywhere
b
okk
w
@boundless-energy-78552 Now we are facing following Compiling livekit-webrtc v0.1.3 (/var/www/html/lkc-rust/livekit-webrtc) Compiling livekit v0.1.3 (/var/www/html/lkc-rust/livekit) Compiling basic_room v0.1.0 (/var/www/html/lkc-rust/examples/basic_room) Finished dev [unoptimized + debuginfo] target(s) in 3m 52s Running
/var/www/html/lkc-rust/examples/target/debug/basic_room src/main.rs
thread 'main' panicked at 'called
Result::unwrap()
on an
Err
value: Engine(Signal(WsError(Tls(Native(Normal(ErrorStack([])))))))', basic_room/src/main.rs2010 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace
e
which value are you using for "LIVEKIT_URL"?
w
e
which OS are you running it in?
w
Debian 11
e
could you try using
rustls-tls-webpki-roots
instead of
native-tls
to see if it works?
👍 1
w
Yes sure We have changed the dependency livekit = { path = "../../livekit", version = "0.1.3", features = ["rustls-tls-webpki-roots"]}
Correct?
👍 1
e
yep, that should be correct
w
OK let us try
e
did it work?
w
No
👀 1
b
Do you have any error?
w
Yes Either In-valid API key (Even we are creating the new API key) ==> Compiling basic_room v0.1.0 (/var/www/html/lkc-rust/examples/basic_room) Finished dev [unoptimized + debuginfo] target(s) in 18.25s Running
/var/www/html/lkc-rust/examples/target/debug/basic_room src/main.rs RUST_BACKTRACE=1
thread 'main' panicked at 'called
Result::unwrap()
on an
Err
value: Engine(Signal(Client(401, "invalid API key")))', basic_room/src/main.rs2010 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace OR Compiling livekit-webrtc v0.1.3 (/var/www/html/lkc-rust/livekit-webrtc) Compiling livekit v0.1.3 (/var/www/html/lkc-rust/livekit) Compiling basic_room v0.1.0 (/var/www/html/lkc-rust/examples/basic_room) Finished dev [unoptimized + debuginfo] target(s) in 3m 52s Running
/var/www/html/lkc-rust/examples/target/debug/basic_room src/main.rs
thread 'main' panicked at 'called
Result::unwrap()
on an
Err
value: Engine(Signal(WsError(Tls(Native(Normal(ErrorStack([])))))))', basic_room/src/main.rs2010 note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace
b
For the first one, how are you creating the token?
w
For first One we have API const createRoom = async ( roomNameAsArgument = "" ) => { console.log( "Create room triggered !!! " ); var roomName = generateRoomId(); const opts = { name: roomName, emptyTimeout: 10 * 60, maxParticipants: 20 }; const room = await svc.createRoom( opts ); // console.log( 'RoomServer created ==> ', room ); return room; }
b
Are you using Cloud?
w
No
b
Maybe your API Key isn’t inside your config.yaml?
Also the API above is not creating a token but it is creating a room. You can use the AccessToken object in the server-sdk-js to create an access token
w
Yes it is creating a token
e
can you paste here how you are creating the token?
w
const createRoomToken = async () => { console.log( "Create room token triggered !!! " ); var roomName = generateRoomId(); const participantName = 'PName'; const at = new AccessToken( 'api-key', 'secret-key', { identity: participantName, } ); at.addGrant( { roomJoin: true, room: roomName } ); return { token: at.toJwt(), roomName: roomName }; }
e
and you receive a
invalid API key
when trying to use this token?
w
Yes
m
@wonderful-engine-41331 does your wss URL and token work here? https://meet.livekit.io/?tab=custom