Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for swapping out the HTTP Client #487

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ members = [

[workspace.dependencies]
libwebrtc = { version = "0.3.7", path = "libwebrtc" }
livekit-api = { version = "0.4.1", path = "livekit-api" }
livekit-api = { version = "0.4.1", path = "livekit-api", default-features = false }
livekit-ffi = { version = "0.12.3", path = "livekit-ffi" }
livekit-protocol = { version = "0.3.6", path = "livekit-protocol" }
livekit-runtime = { version = "0.3.1", path = "livekit-runtime" }
livekit-runtime = { version = "0.3.1", path = "livekit-runtime", default-features = false }
livekit = { version = "0.7.0", path = "livekit" }
soxr-sys = { version = "0.1.0", path = "soxr-sys" }
webrtc-sys-build = { version = "0.3.5", path = "webrtc-sys/build" }
Expand Down
86 changes: 59 additions & 27 deletions livekit-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,57 @@ repository = "https://github.com/livekit/rust-sdks"

[features]
# By default ws TLS is not enabled
default = ["services-tokio", "access-token", "webhooks"]
default = ["services-tokio", "webhooks"]

signal-client-tokio = [
"dep:tokio-tungstenite",
"dep:tokio",
"dep:futures-util",
"dep:reqwest",
"dep:livekit-runtime",
"livekit-runtime/tokio"
"livekit-runtime/tokio",
]

signal-client-async = [
"__signal-client-async-compatible",
"livekit-runtime/async"
"dep:async-tungstenite",
"dep:tokio", # For macros and sync
"dep:futures-util",
"dep:isahc",
"dep:livekit-runtime",
"livekit-runtime/async",
]

signal-client-dispatcher = [
"__signal-client-async-compatible",
"livekit-runtime/dispatcher"
]

__signal-client-async-compatible = [
"dep:async-tungstenite",
"dep:tokio", # For macros and sync
"dep:tokio", # For macros and sync
"dep:futures-util",
"dep:isahc",
"dep:livekit-runtime",
"livekit-runtime/dispatcher",
"dep:serde_json",
]


services-tokio = ["dep:reqwest"]
services-dispatcher = ["dep:serde_json"]
services-async = ["dep:isahc"]
access-token = ["dep:jsonwebtoken"]
webhooks = ["access-token", "dep:serde_json", "dep:base64"]
webhooks = ["dep:serde_json", "dep:base64"]

# Deprecated: old feature that does nothing.
access-token = []

# Note that the following features only change the behavior of tokio-tungstenite.
# It doesn't change the behavior of libwebrtc/webrtc-sys
native-tls = [
"tokio-tungstenite?/native-tls",
"async-tungstenite?/async-native-tls",
"reqwest?/native-tls"
"reqwest?/native-tls",
]
native-tls-vendored = [
"tokio-tungstenite?/native-tls-vendored",
"reqwest?/native-tls-vendored",
]
rustls-tls-native-roots = [
"tokio-tungstenite?/rustls-tls-native-roots",
"async-tungstenite?/async-tls",
"reqwest?/rustls-tls-native-roots",
]
rustls-tls-webpki-roots = [
Expand All @@ -79,18 +82,47 @@ serde_json = { version = "1.0", optional = true }
base64 = { version = "0.21", optional = true }

# access_token & services
jsonwebtoken = { version = "9", default-features = false, optional = true }
http = "0.2.1"
scopeguard = "1.2.0"

# signal_client
livekit-runtime = { path = "../livekit-runtime", version = "0.3.0", optional = true}
tokio-tungstenite = { version = "0.20", optional = true }
async-tungstenite = { version = "0.25.0", features = [ "async-std-runtime", "async-native-tls"], optional = true }
tokio = { version = "1", default-features = false, features = ["sync", "macros", "signal"], optional = true }
futures-util = { version = "0.3", default-features = false, features = [ "sink" ], optional = true }
[dependencies.jsonwebtoken]
version = "9"
default-features = false

# This dependency must be kept in sync with reqwest's version
http = "0.2.1"
reqwest = { version = "0.11", default-features = false, features = [ "json" ], optional = true }
isahc = { version = "1.7.2", default-features = false, features = [ "json", "text-decoding" ], optional = true }
[dependencies.livekit-runtime]
version = "0.3.0"
path = "../livekit-runtime"
optional = true

scopeguard = "1.2.0"
[dependencies.tokio-tungstenite]
version = "0.20"
optional = true

[dependencies.async-tungstenite]
optional = true
version = "0.25.0"
features = ["async-std-runtime", "async-native-tls"]

[dependencies.futures-util]
version = "0.3"
default-features = false
features = ["sink"]
optional = true

[dependencies.tokio]
version = "1"
default-features = false
features = ["sync", "macros", "signal"]
optional = true

[dependencies.reqwest]
version = "0.11"
default-features = false
features = ["json"]
optional = true

[dependencies.isahc]
features = ["json", "text-decoding"]
optional = true
version = "1.7.2"
default-features = false
Loading
Loading