報錯 GLOBAL_GATEWAY_ADDRESS is NULL
參照的 http://www.wtbis.cn/gatewaydoc/advanced/push.html
方法一、使用GatewayClient客戶端推送
目錄截圖:
http://7xjcyk.com1.z0.glb.clouddn.com/屏幕快照%202015-08-26%20下午4.41.58.png
Config/Store.php 文件代碼如下
class Store
{
// 使用文件存儲,注意使用文件存儲無法支持workerman分布式部署
const DRIVER_FILE = 1;
// 使用memcache存儲,支持workerman分布式部署
const DRIVER_MC = 2;
// 使用redis存儲(推薦),支持workerman分布式部署
const DRIVER_REDIS = 3;
// DRIVER_FILE 或者 DRIVER_MC 或者 DRIVER_REDIS(推薦)
public static $driver = self::DRIVER_FILE;
// $driver為DRIVER_MC/DRIVER_REDIS時需要配置memcached/redis服務端ip和端口
public static $gateway = array(
'127.0.0.1:6379',
);
// 存儲房間相關(guān)數(shù)據(jù)
public static $room = array(
'127.0.0.1:6379',
);
// $driver為DRIVER_FILE時要配置此項,實際配置在最下面一行
public static $storePath = '';
}
// 默認系統(tǒng)臨時目錄下
Store::$storePath = dirname(__DIR__).'/chat/';
執(zhí)行的方法:
require_once SITE_PATH.'GatewayClient/Gateway.php';
Gateway::sendToAll('{"type":"broadcast","content":"hello all"}');
求指點問題出在哪里呢?