public static function run($r) { //$URL = PTS_SAVE_RESULTS_PATH . $r[0]; //$master = new websocket('localhost', 12345); if (getenv('PTS_WEBSOCKET_PORT') !== false) { $web_socket_port = getenv('PTS_WEBSOCKET_PORT'); } if (!isset($web_socket_port) || !is_numeric($web_socket_port)) { $web_socket_port = '80'; } pts_web_socket::$debug_mode = true; $websocket = new pts_web_socket('localhost', $web_socket_port); }
public static function run($r) { if (getenv('PTS_WEBSOCKET_PORT') !== false) { $web_socket_port = getenv('PTS_WEBSOCKET_PORT'); } if (!isset($web_socket_port) || !is_numeric($web_socket_port)) { $web_socket_port = pts_config::read_user_config('PhoronixTestSuite/Options/Server/WebSocketPort', '80'); } if (!isset($web_socket_port) || !is_numeric($web_socket_port)) { $web_socket_port = '80'; } /* if(getenv('PTS_PHOROMATIC_SERVER')) { if(function_exists('pcntl_fork')) { $pid = pcntl_fork(); if($pid != -1) { if($pid) { $new_pid = $pid; } else { $event_server = new pts_phoromatic_event_server(); exit(0); } } } else { echo PHP_EOL . 'Phoromatic Event Server Fails To Start Due To Lacking PCNTL Support.' . PHP_EOL . PHP_EOL; } } */ switch (getenv('PTS_WEBSOCKET_SERVER')) { case 'PHOROMATIC': pts_web_socket::$mask_send = true; $websocket = new pts_web_socket_server_phoromatic('localhost', $web_socket_port); break; default: case 'GUI': $websocket = new pts_web_socket_server_gui('localhost', $web_socket_port); break; } }
protected function process_hand_shake($user, $buffer) { $buffer_wrote = parent::process_hand_shake($user, $buffer); return $buffer_wrote; // TODO potentially don't need below code for this back-end XXX if ($buffer_wrote > 0) { $resource = substr($user->res, strrpos($user->res, '/') + 1); switch (strstr($resource . ' ', ' ', true)) { case 'start-user-session': $json = array(); $json['pts']['msg']['name'] = 'user_session_start'; $this->add_to_status('Starting Session', $json); $this->send_json_data($user->socket, $json); // Phodevi $this->add_to_status('Generating Phodevi Cache + VFS', $json); $this->send_json_data($user->socket, $json); phodevi::system_software(true); phodevi::system_hardware(true); $this->phodevi_vfs = new phodevi_vfs(); $this->phodevi_vfs->list_cache_nodes(); // Sensors $this->add_to_status('Starting Phodevi Sensor Handler', $json); $this->send_json_data($user->socket, $json); $this->sensor_logging = new phodevi_sensor_monitor(array('all')); $this->sensor_logging->sensor_logging_start(); // Test Information $this->add_to_status('Downloading Test Information', $json); $this->send_json_data($user->socket, $json); pts_openbenchmarking::available_tests(true); // Complete $this->add_to_status('Session Startup Complete', $json); $this->send_json_data($user->socket, $json); //$this->disconnect($user->socket); break; } return true; } }