mxmbsocket/lib/Ratchet/Protocol/WebSocket/Client.php
Chris Boden ed1a35ff74 HyBi-10 handshake
Hackishly implemented the HyBi-10 handshake
2011-10-27 13:07:24 -04:00

31 lines
783 B
PHP

<?php
namespace Ratchet\Protocol\WebSocket;
use Ratchet\Protocol\WebSocket\Version\VersionInterface;
class Client {
/**
* @type Ratchet\Protocol\WebSocket\Version\VersionInterface
*/
protected $_version = null;
/**
* @type bool
*/
protected $_hands_shook = false;
public function doHandshake(VersionInterface $version) {
$key = $version->sign();
// $tosend['Sec-WebSocket-Accept'] = $key;
$this->_hands_shook = true;
return "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: {$key}\r\nSec-WebSocket-Protocol: test\r\n\r\n";
}
/**
* @return bool
*/
public function isHandshakeComplete() {
return $this->_hands_shook;
}
}