作者 karlet

feat:健壮websocket

... ... @@ -32,7 +32,7 @@ class Websocket
public function __construct($url, $desc = null)
{
$this->url = $url;
$pattern = '/(ws{1,2}):\/\/([\w.a-zA-Z]+):*(\d*)([\/\-\wa-zA-Z?=.]*)/';
$pattern = '/(ws{1,2}):\/\/([\w.a-zA-Z]+):*(\d*)([\/\-\wa-zA-Z?&=.]*)/';
preg_match($pattern, $url, $result);
$this->ssl = $result[1] == 'wss';
$this->host = $result[2];
... ...