/** * URI Socket constructor * * @param string $uri WebSocket URI, e.g. ws://example.org:8000/chat * @param array $options (optional) * Options: * - protocol => Wrench\Protocol object, latest protocol * version used if not specified * - timeout_socket => int, seconds, default 5 * - server_ssl_cert_file => string, server SSL certificate * file location. File should contain * certificate and private key * - server_ssl_passphrase => string, passphrase for the key * - server_ssl_allow_self_signed => boolean, whether to allows self- * signed certs */ public function __construct($uri, array $options = array()) { parent::__construct($options); list($this->scheme, $this->host, $this->port) = $this->protocol->validateSocketUri($uri); }
/** * Constructor * * A server client socket is accepted from a listening socket, so there's * no need to call ->connect() or whatnot. * * @param resource $accepted_socket * @param array $options */ public function __construct($accepted_socket, array $options = array()) { parent::__construct($options); $this->socket = $accepted_socket; $this->connected = (bool) $accepted_socket; }