2017 © Pedro Peláez
 

library ratchet

PHP WebSocket library

image

grandnain/ratchet

PHP WebSocket library

  • Monday, April 9, 2018
  • by Hetarnam
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 508 Forks
  • 0 Open issues
  • 28 Versions
  • 0 % Grown

The README.md

Ratchet

Build Status Autobahn Testsuite Latest Stable Version, (*1)

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., (*2)

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., (*3)

Documentation

User and API documentation is available on Ratchet's website: http://socketo.me, (*4)

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

Need help? Have a question? Want to provide feedback? Write a message on the Google Groups Mailing List., (*6)


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);
    $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!'); };

The Versions

09/04 2018

dev-master

9999999-dev http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jean Walrave

server websocket sockets ratchet websockets

12/12 2017

dev-fix-#516

dev-fix-#516 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

The Development Requires

server websocket sockets ratchet websockets

15/10 2017

dev-router-race-fix

dev-router-race-fix http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

The Development Requires

server websocket sockets ratchet websockets

14/09 2017
06/01 2017

v0.3.6

0.3.6.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

25/05 2016

v0.3.5

0.3.5.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

23/12 2015

v0.3.4

0.3.4.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

27/05 2015

v0.3.3

0.3.3.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

08/06 2014

v0.3.2

0.3.2.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

27/05 2014

v0.3.1

0.3.1.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

14/10 2013

v0.3.0

0.3.0.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

20/09 2013

v0.2.8

0.2.8.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

26/07 2013

dev-wamp-sync-bug

dev-wamp-sync-bug http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

09/06 2013

v0.2.7

0.2.7.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

02/06 2013

v0.2.6

0.2.6.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

02/04 2013

v0.2.5

0.2.5.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

09/03 2013

v0.2.4

0.2.4.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

22/11 2012

v0.2.3

0.2.3.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

20/10 2012

v0.2.2

0.2.2.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

13/10 2012

v0.2.1

0.2.1.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

07/09 2012

v0.2.0

0.2.0.0 http://socketo.me

PHP WebSocket library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

13/07 2012

v0.1.5

0.1.5.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

18/06 2012

v0.1.4

0.1.4.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

15/06 2012

v0.1.3

0.1.3.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

19/05 2012

v0.1.2

0.1.2.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

15/05 2012

0.1.1

0.1.1.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets

11/05 2012

v0.1

0.1.0.0

PHP WebSocket server component library

  Sources   Download

MIT

The Requires

 

server sockets ratchet websockets