2
我希望将PubNub添加到我的聊天服务器以允许实时发送和接收邮件。目前,该服务器采用PHP作为一系列switch-case
操作构建而成。将PubNub添加到聊天服务器
然而,简单地把实例化和订阅服务器的顶部:
$pubnub = new Pubnub(
"key", ## PUBLISH_KEY
"key" ## SUBSCRIBE_KEY
);
// Subscribing to the main server channel
$pubnub->subscribe('MAIN_SERVER', function($message) {
//var_dump($message); ## Print Message
return true; ## Keep listening (return false to stop)
});
....
switch($action)
{
// Complete:
case "userLogin":
//error_log($username,0,"error.log");
if ($userId = authenticateUser($db, $username, $password, $gcmregid))
{
// Then they are a user, so yes, then in app, will call the "syncWithServer" action case
$out = json_encode(array('response' => SUCCESSFUL));
}
else
....
导致服务器超时:
PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\Server\lib\Pubnub\Clients\DefaultClient.php on line 30
如何PubNub被集成到我现在的服务器?