Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 09b7258faf
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (22 sloc) 1.08 kb
<?php
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. */
ini_set('display_errors', 1);
error_reporting(E_ALL);
require(__DIR__ . '/lib/SplClassLoader.php');
$classLoader = new SplClassLoader('WebSocket', __DIR__ . '/lib');
$classLoader->register();
$server = new \WebSocket\Server('127.0.0.1', 8000, false);
// server settings:
$server->setMaxClients(20);
$server->setCheckOrigin(true);
$server->setAllowedOrigin('foo.lh');
$server->setMaxConnectionsPerIp(5);
$server->setMaxRequestsPerMinute(50);
// Hint: Status application should not be removed as it displays usefull server informations:
$server->registerApplication('status', \WebSocket\Application\StatusApplication::getInstance());
$server->registerApplication('demo', \WebSocket\Application\DemoApplication::getInstance());
$server->run();
Jump to Line
Something went wrong with that request. Please try again.