Driver: Support tokio-websockets (#226)

* Driver: Support `tokio-websockets`

* Fix bad feature flag

* Fix CI & examples features

* Use tungstenite in twilight example

* Error if none or both ws features are enabled

* Match `twilight-gateway` features
This commit is contained in:
Carson M
2024-02-28 14:47:09 -06:00
committed by Kyle Simpson
parent 0d6a226910
commit c4331c451f
6 changed files with 108 additions and 15 deletions

View File

@@ -49,6 +49,7 @@ symphonia = { default-features = false, optional = true, version = "0.5.2" }
symphonia-core = { optional = true, version = "0.5.2" }
tokio = { default-features = false, optional = true, version = "1.0" }
tokio-tungstenite = { optional = true, version = "0.21" }
tokio-websockets = { optional = true, version = "0.5", features = ["client", "fastrand", "sha1_smol", "simd"] }
tokio-util = { features = ["io"], optional = true, version = "0.7" }
tracing = { version = "0.1", features = ["log"] }
tracing-futures = "0.2"
@@ -72,6 +73,7 @@ default = [
"gateway",
"rustls",
"serenity",
"tungstenite"
]
gateway = [
"dep:async-trait",
@@ -108,7 +110,6 @@ driver = [
"dep:symphonia",
"dep:symphonia-core",
"dep:tokio",
"dep:tokio-tungstenite",
"dep:tokio-util",
"dep:typenum",
"dep:url",
@@ -127,6 +128,8 @@ rustls = [
"serenity?/rustls_backend",
"stream_lib?/rustls-tls",
"tokio-tungstenite?/rustls-tls-webpki-roots",
"tokio-websockets?/ring",
"tokio-websockets?/rustls-native-roots",
"twilight-gateway?/rustls-native-roots",
]
native = [
@@ -134,8 +137,11 @@ native = [
"serenity?/native_tls_backend",
"stream_lib?/native-tls",
"tokio-tungstenite?/native-tls",
"tokio-websockets?/native-tls",
"twilight-gateway?/native",
]
tungstenite = ["dep:tokio-tungstenite"]
tws = ["dep:tokio-websockets"]
twilight = ["dep:twilight-gateway","dep:twilight-model"]
# Behaviour altering features.
@@ -143,7 +149,7 @@ builtin-queue = []
receive = ["dep:bytes", "discortp?/demux", "discortp?/rtcp"]
# Used for docgen/testing/benchmarking.
full-doc = ["default", "twilight", "builtin-queue", "receive"]
full-doc = ["default", "tungstenite", "twilight", "builtin-queue", "receive"]
internals = ["dep:byteorder"]
[lib]