報(bào)錯(cuò) GLOBAL_GATEWAY_ADDRESS is NULL
參照的 http://m.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
{
// 使用文件存儲(chǔ),注意使用文件存儲(chǔ)無(wú)法支持workerman分布式部署
const DRIVER_FILE = 1;
// 使用memcache存儲(chǔ),支持workerman分布式部署
const DRIVER_MC = 2;
// 使用redis存儲(chǔ)(推薦),支持workerman分布式部署
const DRIVER_REDIS = 3;
// DRIVER_FILE 或者 DRIVER_MC 或者 DRIVER_REDIS(推薦)
public static $driver = self::DRIVER_FILE;
// $driver為DRIVER_MC/DRIVER_REDIS時(shí)需要配置memcached/redis服務(wù)端ip和端口
public static $gateway = array(
'127.0.0.1:6379',
);
// 存儲(chǔ)房間相關(guān)數(shù)據(jù)
public static $room = array(
'127.0.0.1:6379',
);
// $driver為DRIVER_FILE時(shí)要配置此項(xiàng),實(shí)際配置在最下面一行
public static $storePath = '';
}
// 默認(rèn)系統(tǒng)臨時(shí)目錄下
Store::$storePath = dirname(__DIR__).'/chat/';
執(zhí)行的方法:
require_once SITE_PATH.'GatewayClient/Gateway.php';
Gateway::sendToAll('{"type":"broadcast","content":"hello all"}');
求指點(diǎn)問題出在哪里呢?