2017 © Pedro Peláez
 

library websockets

Helps to use websockets

image

teddy/websockets

Helps to use websockets

  • Sunday, May 15, 2016
  • by Grez
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Teddy\WebSockets

Extension, helps with using WebSockets, (*1)

Usage

composer require teddy/websockets, (*2)

Copy websockets.js file, override the Controller, add /bin/server.php Run /bin/server.php, (*3)

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;

require dirname(__DIR__) . '/vendor/autoload.php';

$rootDir = __DIR__ . '/..';

$params = [
    'wwwDir' => $rootDir . '/www',
    'appDir' => $rootDir . '/app',
    'tempDir' => $rootDir . '/temp',
    'testMode' => TRUE
];
$configurator = (new Nette\Configurator($params))
    ->addConfig(__DIR__ . '/config.neon')
    ->setDebugMode(TRUE);
$configurator->createRobotLoader()
    ->addDirectory(__DIR__ . '/../app')
    ->register();
$container = $configurator->createContainer();

$server = IoServer::factory(
    new HttpServer(
        new WsServer(
            new \Teddy\WebSockets\Controller($container) // you should override this class
        )
    ),
    8080
);

$server->run();

It is neccessary to create subdomain wss.domain.tld, becase SSL won't work otherwise. http://grezcz.tumblr.com/post/143320629816/rozchozen%C3%AD-ratchetu-na-ssl (check whether it won't break HTTP o_O), (*4)

The Versions

15/05 2016

dev-master

9999999-dev

Helps to use websockets

  Sources   Download

MIT GPL-3.0 GPL-2.0

The Requires

 

by Tom Bartoň