All Projects → actix → Sockjs

actix / Sockjs

Licence: apache-2.0
SockJS server for rust language

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Sockjs

Cppserver
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 528 (+738.1%)
Mutual labels:  websocket, websocket-server
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+1168.25%)
Mutual labels:  websocket, websocket-server
Autobahn Testsuite
Autobahn WebSocket protocol testsuite
Stars: ✭ 603 (+857.14%)
Mutual labels:  websocket, websocket-server
Websocket
simple php websocket server + demos + yii/yii2 integration + php 7 support
Stars: ✭ 363 (+476.19%)
Mutual labels:  websocket, websocket-server
Websock3ds
Example websocket server for Nintendo 3DS
Stars: ✭ 13 (-79.37%)
Mutual labels:  websocket, websocket-server
Microwebsrv
A micro HTTP Web server that supports WebSockets, html/python language templating and routing handlers, for MicroPython (used on Pycom modules & ESP32)
Stars: ✭ 420 (+566.67%)
Mutual labels:  websocket, websocket-server
Cowboy
Small, fast, modern HTTP server for Erlang/OTP.
Stars: ✭ 6,533 (+10269.84%)
Mutual labels:  websocket, websocket-server
Ws
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js
Stars: ✭ 17,419 (+27549.21%)
Mutual labels:  websocket, websocket-server
Awesome Websockets
A curated list of Websocket libraries and resources.
Stars: ✭ 850 (+1249.21%)
Mutual labels:  websocket, websocket-server
Oatpp Websocket
oatpp-websocket submodule.
Stars: ✭ 26 (-58.73%)
Mutual labels:  websocket, websocket-server
Websockets
Library for building WebSocket servers and clients in Python
Stars: ✭ 3,724 (+5811.11%)
Mutual labels:  websocket, websocket-server
Jiny
Lightweight, modern, simple JVM web framework for rapid development in the API era
Stars: ✭ 40 (-36.51%)
Mutual labels:  websocket, websocket-server
Websocketlistener
A lightweight and scalable asynchronous WebSocket listener
Stars: ✭ 295 (+368.25%)
Mutual labels:  websocket, websocket-server
Websocket
The Hoa\Websocket library.
Stars: ✭ 421 (+568.25%)
Mutual labels:  websocket, websocket-server
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (+368.25%)
Mutual labels:  websocket, websocket-server
Turbo Ws
💨 Blazing fast low-level WebSocket server
Stars: ✭ 647 (+926.98%)
Mutual labels:  websocket, websocket-server
Cwebsocket
cWebsocket is lightweight websocket server library
Stars: ✭ 241 (+282.54%)
Mutual labels:  websocket, websocket-server
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+5044.44%)
Mutual labels:  websocket, websocket-server
Beetlex
high performance dotnet core socket tcp communication components, support TLS, HTTP, HTTPS, WebSocket, RPC, Redis protocols, custom protocols and 1M connections problem solution
Stars: ✭ 802 (+1173.02%)
Mutual labels:  websocket, websocket-server
Babl
Low-latency WebSocket Server
Stars: ✭ 37 (-41.27%)
Mutual labels:  websocket, websocket-server

SockJS server Build Status codecov crates.io

SockJS server for Actix framework.


Actix SockJS is licensed under the Apache-2.0 license.

Usage

To use sockjs, add this to your Cargo.toml:

[dependencies]
sockjs = "0.2"

Supported transports

Simple chat example

extern crate actix;
extern crate actix_web;
extern crate sockjs;

use actix_web::*;
use actix::prelude::*;
use sockjs::{Message, Session, CloseReason, SockJSManager, SockJSContext};

struct Chat;

/// `SockJSContext` context is required for sockjs session
impl Actor for Chat {
    type Context = SockJSContext<Self>;
}

/// Session has to implement `Default` trait
impl Default for Chat {
    fn default() -> Chat { Chat }
}

/// Sockjs session trait
impl Session for Chat {
    fn opened(&mut self, ctx: &mut SockJSContext<Self>) {
        ctx.broadcast("Someone joined.")
    }
    fn closed(&mut self, ctx: &mut SockJSContext<Self>, _: CloseReason) {
        ctx.broadcast("Someone left.")
    }
}

/// Session has to be able to handle `sockjs::Message` messages
impl Handler<Message> for Chat {
    type Result = ();

    fn handle(&mut self, msg: Message, ctx: &mut SockJSContext<Self>)
    {
        // broadcast message to all sessions
        ctx.broadcast(msg);
    }
}


fn main() {
    let sys = actix::System::new("sockjs-chat");

    // SockJS sessions manager
    let sm: Addr<Syn, _> = SockJSManager::<Chat>::start_default();

    HttpServer::new(move || {
        let manager = sm.clone();
        Application::new()
            // register SockJS application
            .handler(
                "/sockjs/", sockjs::SockJS::new(manager.clone()))})
        .bind("127.0.0.1:8080").unwrap()
        .start();

    // let _ = sys.run();
}

Full chat example

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].