小编Dar*_*ess的帖子

PHP Websocket和Wamp Server出错

我对这个Websockets真的很新,我正在尝试连接这个websocket:phpwebsocket和WAMP服务器,首先,在我的httpd.conf中我写了听9300,如果我去localhost:9300它工作正常,但是当我去控制台写道:

 php -q C:\wamp\www\demos\server.php
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

错误

这是server.php的代码:

<?php
set_time_limit(0);
require 'class.PHPWebSocket.php';
function wsOnMessage($clientID, $message, $messageLength, $binary) {
    global $Server;
    $ip = long2ip( $Server->wsClients[$clientID][6] );
    if ($messageLength == 0) {
        $Server->wsClose($clientID);
        return;
    }

    if ( sizeof($Server->wsClients) == 1 )
        $Server->wsSend($clientID, "There isn't anyone else in the room, but I'll still listen to you. --Your Trusty Server");
    else
        foreach ( $Server->wsClients as $id => $client )
            if ( $id != $clientID )
                $Server->wsSend($id, "Visitor $clientID ($ip) said \"$message\"");
}
function wsOnOpen($clientID) …
Run Code Online (Sandbox Code Playgroud)

php apache wamp websocket phpwebsocket

4
推荐指数
1
解决办法
5379
查看次数

标签 统计

apache ×1

php ×1

phpwebsocket ×1

wamp ×1

websocket ×1