7 个版本 (破坏性更新)
新 0.7.0 | 2024 年 8 月 15 日 |
---|---|
0.6.0 | 2024 年 7 月 31 日 |
0.5.2 | 2024 年 6 月 14 日 |
0.4.0 | 2024 年 3 月 27 日 |
0.0.0 |
|
#38 在 WebSocket
每月 3,365 次下载
在 18 个 Crates 中使用 (通过 nostr-relay-pool)
75KB
1.5K SLoC
异步 WebSocket
适用于在本地和 WASM 环境中使用 WebSocket 的便捷库!包括嵌入式 tor 客户端支持。
use std::time::Duration;
use async_wsocket::{ConnectionMode, Url};
#[tokio::main]
async fn main() {
let url = Url::parse("wss://example.com").unwrap();
// Use `ConnectionMode::Tor` to use the embedded tor client (require `tor` feature)
let (_tx, _rx) = async_wsocket::connect(&url, ConnectionMode::Direct, Duration::from_secs(120))
.await
.unwrap();
}
库功能标志
以下库功能标志可用
功能 | 默认 | 描述 |
---|---|---|
socks |
否 | 启用 socks 代理支持 |
tor |
否 | 启用嵌入式 tor 客户端支持 |
最低支持的 Rust 版本 (MSRV)
当使用默认功能并在 native
目标编译时,此项目的 MSRV 为 1.63.0
。当使用 tor
功能时,MSRV 为 1.70.0
。WASM 目标的 MSRV 为 1.73.0
许可证
本项目在 MIT 软件许可证下分发 - 有关详细信息,请参阅 LICENSE 文件
捐赠
⚡ 小费: https://getalby.com/p/yuki
⚡ Lightning 地址: [email protected]
依赖关系
~2–24MB
~380K SLoC