GithubHelp home page GithubHelp logo

yukibtc / async-wsocket Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 162 KB

A convenience library for using websockets both in native and WASM environments!

Home Page: https://crates.io/crates/async-wsocket

License: MIT License

Makefile 0.72% Rust 99.28%
native rust-lang wasm websocket

async-wsocket's Introduction

Async WebSocket

A convenience library for using websockets both in native and WASM environments! Include embedded tor client support.

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();
}

Crate Feature Flags

The following crate feature flags are available:

Feature Default Description
socks No Enable socks proxy support
tor No Enable embedded tor client support

Minimum Supported Rust Version (MSRV)

The MSRV for this project when compiled with default features and on native targets is 1.63.0. When using tor feature, MSRV is 1.70.0. MSRV for WASM targets is 1.73.0

License

This project is distributed under the MIT software license - see the LICENSE file for details

Donations

⚡ Tips: https://getalby.com/p/yuki

⚡ Lightning Address: [email protected]

async-wsocket's People

Contributors

yukibtc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

shabbirhasan1

async-wsocket's Issues

How to read stream

Obvious question. But please add both recv and send instead of _tx, _rx in the example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.