WebSocketServer::__construct PHP Method

__construct() public method

public __construct ( )
    public function __construct()
    {
        define('APPLICATION_PATH', dirname(dirname(__DIR__)) . "/application");
        $this->application = new Yaf_Application(dirname(APPLICATION_PATH) . "/conf/application.ini");
        $this->application->bootstrap();
        $server = new swoole_websocket_server("0.0.0.0", 9503);
        $server->set(array('daemonize' => true));
        $server->on('Open', array($this, 'onOpen'));
        $server->on('Message', array($this, 'onMessage'));
        $server->on('Close', array($this, 'onClose'));
        $server->start();
    }

Usage Example

Ejemplo n.º 1
0
 public function __construct($addr, $port)
 {
     parent::__construct($addr, $port);
     $this->clients = new SplObjectStorage();
     // Services
     $services = @file_get_contents(self::SERVICES_PATH);
     if ($services) {
         $this->websocket_services = (array) json_decode($services, true);
     }
 }
All Usage Examples Of WebSocketServer::__construct