-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: wss -> ws, and example uses local dev server
- Loading branch information
Showing
10 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use jarust::jaconfig::JaConfig; | ||
use jarust::jaconfig::TransportType; | ||
use jarust::japlugin::Attach; | ||
use log::LevelFilter; | ||
use log::SetLoggerError; | ||
use serde_json::json; | ||
use simple_logger::SimpleLogger; | ||
|
||
#[tokio::main(flavor = "current_thread")] | ||
async fn main() -> anyhow::Result<()> { | ||
init_logger()?; | ||
|
||
let mut connection = jarust::connect( | ||
JaConfig::new("wss://janus.conf.meetecho.com/ws", None, "janus"), | ||
TransportType::Ws, | ||
) | ||
.await?; | ||
let session = connection.create(10).await?; | ||
let (handle, mut event_receiver) = session.attach("janus.plugin.echotest").await?; | ||
|
||
handle | ||
.message(json!({ | ||
"video": true, | ||
"audio": true, | ||
})) | ||
.await?; | ||
|
||
while let Some(event) = event_receiver.recv().await { | ||
log::info!("response: {event:?}"); | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
fn init_logger() -> Result<(), SetLoggerError> { | ||
SimpleLogger::new() | ||
.with_level(LevelFilter::Trace) | ||
.with_colors(true) | ||
.with_module_level("tokio_tungstenite", LevelFilter::Off) | ||
.with_module_level("tungstenite", LevelFilter::Off) | ||
.with_module_level("want", LevelFilter::Off) | ||
.with_module_level("rustls", LevelFilter::Off) | ||
.init() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
pub mod trans; | ||
#[cfg(target_family = "wasm")] | ||
pub mod wasm_wss; | ||
pub mod wasm_web_socket; | ||
#[cfg(not(target_family = "wasm"))] | ||
pub mod wss; | ||
pub mod web_socket; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters