国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman push windows下能收到ping/pong,但收不到推送消息

keroppi

問題描述

這里詳細(xì)描述問題
windows 用命令行啟動 php windows.php 客戶端能連接、正常處理ping/pong ,但收不到服務(wù)端推送的消息

程序代碼

服務(wù)器

use Webman\Push\Api as PushApi;

try {
$pushApi = new PushApi(
    config('plugin.webman.push.app.api'),
    config('plugin.webman.push.app.app_key'),
    config('plugin.webman.push.app.app_secret')
);
} catch (PushException $e) {
    echo $e->getMessage();

    return 'initial error';
}

for ($i = 0; $i < 20; $i++) {

    $msg = "test message {$i}";
    echo $msg."\n";
    $pushApi->trigger("user-game", "message", [
        'from_uid' => 2,
        'content'  => "你好,這個是消息內(nèi)容: {$i}"
    ]);
}

前端代碼

<script>
    window.onload = function(){

        var connection = new Push({
            url: 'ws://127.0.0.1:3131', // websocket地址
            app_key: 'aaa271c93a460f6212870a93c4133b27',
            auth: '/plugin/webman/push/auth' // 訂閱鑒權(quán)
        });

        // 瀏覽器監(jiān)聽 game 頻道消息
        var game_channel = connection.subscribe('user-game');

        game_channel.on('message', function(data) {
            // data里是消息內(nèi)容
            console.log(data);
        });
    }
</script>    

報錯信息

前端控制臺查看 websocket 相應(yīng)信息

{"event":"pusher:connection_established","data":"{\"socket_id\":\"1.4\",\"activity_timeout\":55}"}  98  
17:12:14.662
{"event":"pusher:subscribe","data":{"channel":"user-game"}} 59  
17:12:14.663
{"event":"pusher_internal:subscription_succeeded","data":"{}","channel":"user-game"}    84  
17:12:14.663
{"event":"pusher:ping","data":{}}   33  
17:12:40.633
{"event":"pusher:pong","data":"{}"} 35  
17:12:40.633
{"event":"pusher:ping","data":{}}   33  
17:13:06.631
{"event":"pusher:pong","data":"{}"} 35  
17:13:06.632
{"event":"pusher:ping","data":{}}   33  
17:13:32.625
{"event":"pusher:pong","data":"{}"}

操作系統(tǒng)及workerman/webman等框架組件具體版本

"workerman/webman-framework": "~2.1",
"webman/push": "^1.1"

186 0 1
0個回答

??