chore: clarify UDP on WASM

This commit is contained in:
kozabrada123 2023-12-30 11:42:44 +01:00
parent 65213bb0fb
commit 2b729dc8fd
4 changed files with 8 additions and 28 deletions

View File

@ -15,7 +15,7 @@ default = ["client", "rt-multi-thread"]
backend = ["dep:poem", "dep:sqlx"] backend = ["dep:poem", "dep:sqlx"]
rt-multi-thread = ["tokio/rt-multi-thread"] rt-multi-thread = ["tokio/rt-multi-thread"]
rt = ["tokio/rt"] rt = ["tokio/rt"]
client = ["voice"] client = []
voice = ["dep:discortp", "dep:crypto_secretbox"] voice = ["dep:discortp", "dep:crypto_secretbox"]
[dependencies] [dependencies]

View File

@ -128,7 +128,7 @@ pub mod instance;
#[cfg(feature = "client")] #[cfg(feature = "client")]
pub mod ratelimiter; pub mod ratelimiter;
pub mod types; pub mod types;
#[cfg(feature = "client")] #[cfg(all(feature = "client", feature = "voice"))]
pub mod voice; pub mod voice;
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Clone, Default, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]

View File

@ -1,19 +1,12 @@
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] #[cfg(all(not(target_arch = "wasm32"), feature = "voice"))]
pub mod tokio; pub mod tokio;
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] #[cfg(all(not(target_arch = "wasm32"), feature = "voice"))]
pub use tokio::*; pub use tokio::*;
#[cfg(all(target_arch = "wasm32", feature = "client"))] #[cfg(all(not(target_arch = "wasm32"), feature = "voice"))]
pub mod wasm;
#[cfg(all(target_arch = "wasm32", feature = "client"))]
pub use wasm::*;
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))]
pub type UdpSocket = tokio::TokioSocket; pub type UdpSocket = tokio::TokioSocket;
#[cfg(all(not(target_arch = "wasm32"), feature = "client"))] #[cfg(all(not(target_arch = "wasm32"), feature = "voice"))]
pub type UdpBackend = tokio::TokioBackend; pub type UdpBackend = tokio::TokioBackend;
#[cfg(all(target_arch = "wasm32", feature = "client"))] #[cfg(target_arch = "wasm32")]
pub type UdpSocket = wasm::WasmSocket; compile_error!("UDP Voice support is not (and will likely never be) supported for WASM. This is because UDP cannot be used in the browser. We are however looking into Webrtc for WASM voice support.");
#[cfg(all(target_arch = "wasm32", feature = "client"))]
pub type UdpBackend = wasm::WasmBackend;

View File

@ -1,13 +0,0 @@
use std::net::SocketAddr;
// TODO: Add wasm websockets
compile_error!("Udp voice support is not implemented yet for wasm.");
#[derive(Debug, Clone)]
pub struct WasmBackend;
pub type WasmSocket;
impl WasmBackend {
pub async fn connect(url: SocketAddr) -> Result<WasmSocket, VoiceUdpError> {}
}