All Projects → ratchetphp → Ratchet

ratchetphp / Ratchet

Licence: mit
Asynchronous WebSocket server

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Ratchet

Async Tungstenite
Async binding for Tungstenite, the Lightweight stream-based WebSocket implementation
Stars: ✭ 207 (-96.3%)
Mutual labels:  async, websocket, websockets
Channelstream
Channelstream is a websocket communication server for web applications
Stars: ✭ 52 (-99.07%)
Mutual labels:  async, websocket, websockets
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 (-94.73%)
Mutual labels:  async, websocket, websockets
Aiowebsocket
Async WebSocket Client. Advantage: Flexible Lighter and Faster
Stars: ✭ 263 (-95.3%)
Mutual labels:  async, websocket, websockets
Websockets
Library for building WebSocket servers and clients in Python
Stars: ✭ 3,724 (-33.45%)
Mutual labels:  websocket, websockets
Python Slack Sdk
Slack Developer Kit for Python
Stars: ✭ 3,307 (-40.9%)
Mutual labels:  websocket, websockets
Starlette
The little ASGI framework that shines. 🌟
Stars: ✭ 6,337 (+13.24%)
Mutual labels:  async, websockets
Wssip
Application for capturing, modifying and sending custom WebSocket data from client to server and vice versa.
Stars: ✭ 373 (-93.33%)
Mutual labels:  websocket, websockets
Node Slack Sdk
Slack Developer Kit for Node.js
Stars: ✭ 2,988 (-46.6%)
Mutual labels:  websocket, websockets
Ttyd
Share your terminal over the web
Stars: ✭ 4,030 (-27.98%)
Mutual labels:  websocket, websockets
Ntex
framework for composable networking services
Stars: ✭ 381 (-93.19%)
Mutual labels:  async, websockets
Websocket Client
🔧 .NET/C# websocket client library
Stars: ✭ 297 (-94.69%)
Mutual labels:  websocket, websockets
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 (-92.49%)
Mutual labels:  websocket, websockets
Laravel S
LaravelS is an out-of-the-box adapter between Swoole and Laravel/Lumen.
Stars: ✭ 3,479 (-37.83%)
Mutual labels:  async, websocket
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (-42.08%)
Mutual labels:  websocket, websockets
Swoole Src
🚀 Coroutine-based concurrency library for PHP
Stars: ✭ 17,175 (+206.92%)
Mutual labels:  async, websocket
Tokio Tungstenite
Tokio binding for Tungstenite, the Lightweight stream-based WebSocket implementation
Stars: ✭ 392 (-92.99%)
Mutual labels:  websocket, websockets
Pawl
Asynchronous WebSocket client
Stars: ✭ 448 (-91.99%)
Mutual labels:  async, websockets
Rsocket Kotlin
RSocket Kotlin multi-platform implementation
Stars: ✭ 256 (-95.43%)
Mutual labels:  async, websocket
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (-90.49%)
Mutual labels:  websocket, websockets

Ratchet

GitHub Actions Autobahn Testsuite Latest Stable Version

A PHP library for asynchronously serving WebSockets. Build up your application through simple interfaces and re-use your application without changing any of its code just by combining different components.

Requirements

Shell access is required and root access is recommended. To avoid proxy/firewall blockage it's recommended WebSockets are requested on port 80 or 443 (SSL), which requires root access. In order to do this, along with your sync web stack, you can either use a reverse proxy or two separate machines. You can find more details in the server conf docs.

Documentation

User and API documentation is available on Ratchet's website: http://socketo.me

See https://github.com/cboden/Ratchet-examples for some out-of-the-box working demos using Ratchet.

Need help? Have a question? Want to provide feedback? Write a message on the Google Groups Mailing List.


A quick example

<?php
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

    // Make sure composer dependencies have been installed
    require __DIR__ . '/vendor/autoload.php';

/**
 * chat.php
 * Send any incoming messages to all connected clients (except sender)
 */
class MyChat implements MessageComponentInterface {
    protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;
    }

    public function onOpen(ConnectionInterface $conn) {
        $this->clients->attach($conn);
    }

    public function onMessage(ConnectionInterface $from, $msg) {
        foreach ($this->clients as $client) {
            if ($from != $client) {
                $client->send($msg);
            }
        }
    }

    public function onClose(ConnectionInterface $conn) {
        $this->clients->detach($conn);
    }

    public function onError(ConnectionInterface $conn, \Exception $e) {
        $conn->close();
    }
}

    // Run the server application through the WebSocket protocol on port 8080
    $app = new Ratchet\App('localhost', 8080);
    $app->route('/chat', new MyChat, array('*'));
    $app->route('/echo', new Ratchet\Server\EchoServer, array('*'));
    $app->run();
$ php chat.php
    // Then some JavaScript in the browser:
    var conn = new WebSocket('ws://localhost:8080/echo');
    conn.onmessage = function(e) { console.log(e.data); };
    conn.onopen = function(e) { conn.send('Hello Me!'); };
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].