$fp = fsockopen("ssl://streaming.vk.com", 443, $errno, $errstr, 30);
if (is_bool($fp))
return false;
$out = "GET /stream?key=HTTP/1.1\r\n";
$out .= "Host: streaming.vk.com\r\n";
$out .= "Content-Type: application/json\r\n";
$out .= "Connection: upgrade\r\n";
$out .= "Sec-WebSocket-Key: Iv8io/9s+lYFgZWcXczP8Q==\r\n";
$out .= "Upgrade: websocket\r\n";
$out .= "Sec-Websocket-Version: 13\r\n\r\n";
fwrite($fp, $out);
while (true) {
$read = fread ($fp , 1000000);
if (strlen ($read)==0)
break;
var_dump (bin2hex($read[0]));
var_dump ($read);
}
Собственно как ловить PING, и как формировать PONG?