当WebSocket握手完成后,我会收到一个与浏览器不同的PHPSESSID,为什么会这样?
连接的客户端代码:
websocket = new WebSocket("ws://192.168.0.109:9000/php_servers/socketserver1/socketserver.php");
读取标题的服务器代码:
<?php
include "../serverfunctions.php";
include "eventfunctions.php";
$host = '192.168.0.109';
$port = '9000';
$null = NULL;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_bind($socket, 0, $port);
socket_listen($socket);
$clients = array($socket);
while (true)
{
$changed = $clients;
socket_select($changed, $null, $null, 0, 10);
if (in_array($socket, $changed))
{
$socket_new = socket_accept($socket);
$clients[] = $socket_new;
$header = socket_read($socket_new, 1024);