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

chore/remove unnecessary crates #24

Merged
merged 5 commits into from
Jan 10, 2024
Merged
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
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["jarust", "jarust_make_plugin", "jarust_plugins", "client"]
members = ["jarust", "jarust_make_plugin", "jarust_plugins"]

[workspace.package]
version = "0.1.2"
Expand All @@ -18,5 +18,5 @@ async-trait = "0.1.77"
log = "0.4.20"
tokio = { version = "1.35.1", features = ["sync", "time", "rt"] }
tokio-tungstenite = { version = "0.21.0", features = ["native-tls"] }
serde = { version = "1.0.194", features = ["derive"] }
serde_json = "1.0.110"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,7 @@ Internally uses WebSockets to connect to Janus.

The library wraps the Janus core API and some of the most popular plugins APIs.

## Example Usage
## Examples

This is just a pretty simple hello world for the echotest plugin.

```rs
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut connection = jarust::connect(JaConfig::new(
"wss://janus.conf.meetecho.com/ws",
None,
TransportType::Wss,
"janus",
))
.await?;

let session = connection.create(10).await?;
let handle = session.attach("janus.plugin.echotest").await?;
}
```
- [jarust examples](./jarust/examples/), example usage of jarust.
- [plugins examples](./jarust_plugins/examples/), example usage of jarust's predefined plugins.
14 changes: 0 additions & 14 deletions client/Cargo.toml

This file was deleted.

4 changes: 3 additions & 1 deletion jarust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ tokio-tungstenite.workspace = true
tokio.workspace = true

[dev-dependencies]
tokio = { version = "1.35.1", features = ["macros"] }
anyhow = "1.0.79"
simple_logger = "4.3.3"
tokio = { version = "1.35.1", features = ["time", "macros", "rt-multi-thread"] }
3 changes: 3 additions & 0 deletions jarust/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

- [raw_echotest.rs](./raw_echotest.rs), echotest but without using the predefined echotest plugin.
45 changes: 45 additions & 0 deletions jarust/examples/raw_echotest.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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,
TransportType::Wss,
"janus",
))
.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)
.init()
}
9 changes: 7 additions & 2 deletions jarust_plugins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ doctest = false

[dependencies]
async-trait.workspace = true
jarust = { version = "0.1.0", path = "../jarust" }
jarust_make_plugin = { version = "0.1.0", path = "../jarust_make_plugin" }
jarust = { version = "0.1.2", path = "../jarust" }
jarust_make_plugin = { version = "0.1.2", path = "../jarust_make_plugin" }
log.workspace = true
serde_json.workspace = true
serde.workspace = true
Expand All @@ -25,3 +25,8 @@ tokio = { version = "1.35.1", features = ["sync"] }
[features]
default = ["echotest"]
echotest = []

[dev-dependencies]
anyhow = "1.0.79"
simple_logger = "4.3.3"
tokio = { version = "1.35.1", features = ["time", "macros", "rt-multi-thread"] }
3 changes: 3 additions & 0 deletions jarust_plugins/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

- [echotest.rs](./echotest.rs), example on using the predefined echotest plugin.
1 change: 0 additions & 1 deletion client/src/main.rs → jarust_plugins/examples/echotest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use simple_logger::SimpleLogger;
async fn main() -> anyhow::Result<()> {
init_logger()?;

// To make sure handle is working even after dropping the session and the connection
let mut connection = jarust::connect(JaConfig::new(
"wss://janus.conf.meetecho.com/ws",
None,
Expand Down
Loading