@Google Meet
Stateful Protocol
Full Duplex
Bi-directional Messaging Pattern
Long-lived TCP Connection
Widely Supported by Modern Browsers
More Efficient Than HTTP Polling
GET / HTTP/1.1
Host: www.cnn.com
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.68 Safari/537.17
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: [[[2428 byte of cookie data]]]
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 13 Feb 2013 18:56:27 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: CG=US:TX:Arlington; path=/
Last-Modified: Wed, 13 Feb 2013 18:55:22 GMT
Vary: Accept-Encoding
Cache-Control: max-age=60, private
Expires: Wed, 13 Feb 2013 18:56:54 GMT
Content-Encoding: gzip
<?php
$server = new Swoole\WebSocket\Server('0.0.0.0', 9501);
$server->on('open', function ($server, $request) {
echo "handshake succeeded with fd {$request->fd}\n";
});
$server->on('message', function ($server, $frame) {
if ($frame->data === 'exit') {
$server->disconnect($frame->fd);
return;
}
echo "received from {$frame->fd}:{$frame->data}, opcode:{$frame->opcode}, fin:{$frame->finish}\n";
$server->push($frame->fd, $frame->data);
});
$server->on('close', function ($server, $fd) {
echo "client {$fd} closed\n";
});
echo "Server is starting...\n";
$server->start();
for Large Payload Transfer?