Code Monkey home page Code Monkey logo

ezsockets's Introduction

ezsockets

Creating a WebSocket server or a client in Rust can be troublesome. This crate facilitates this process by providing:

  • Traits to allow declarative and event-based programming.
  • Easy concurrency with Tokio and async/await. Server sessions are Clone'able and can be shared between tasks.
  • Heartbeat mechanism to keep the connection alive.
  • Automatic reconnection of WebSocket Clients.
  • Support for arbitrary client back-ends, with built-in native and WASM client connectors.
  • Support for multiple server back-ends such as Axum or Tungstenite.
  • TLS support for servers with rustls and native-tls.

Documentation

View the full documentation at docs.rs/ezsockets

Examples

  • simple-client - a simplest WebSocket client which uses stdin as input.
  • echo-server - server that echoes back every message it receives.
  • echo-server - same as echo-server, but with native-tls.
  • counter-server - server that increments global value every second and shares it with client
  • chat-client - chat client for chat-server and chat-server-axum examples
  • wasm-client - chat client for chat-server and chat-server-axum examples that runs in the browser (only listens to the chat)
  • chat-server - chat server with support of rooms
  • chat-server-axum - same as above, but using axum as a back-end

Client

By default clients use tokio-tungstenite under the hood. Disable default features and enable wasm_client to run clients on WASM targets.

See examples/simple-client for a simple usage and docs.rs/ezsockets/server for documentation.

Server

WebSocket server can use one of the supported back-ends:

  • tokio-tungstenite - the simplest way to get started.
  • axum - ergonomic and modular web framework built with Tokio, Tower, and Hyper
  • actix-web - Work in progress at #22

See examples/echo-server for a simple usage and docs.rs/ezsockets/server for documentation.

License

Licensed under MIT.

Contact

Reach me out on Discord gbaranski#5119, or mail me at [email protected].

ezsockets's People

Contributors

gbaranski avatar ukoehb avatar jakkusakura avatar stanbar avatar stymaar avatar

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.