我在 React Native 中使用 Pusher。
尝试从调试控制台获取消息。
成功收到 2 条消息,在控制台中收到此消息后:
Pusher : : [{"type":"PusherError","data":{"code":4009,"message":"Connection not authorized within timeout"}}]
Pusher : : ["State changed","connected -> disconnected"]
Pusher : : [{"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4009,"message":"Connection not authorized within timeout"}}}]
Run Code Online (Sandbox Code Playgroud)
这是我的绑定:
channel.bind("Chat", function (data) {
var newArr = initialMessages.reverse();
var message = creteNewMessage(JSON.stringify(data));
newArr.push(message);
console.log(newArr);
});
Run Code Online (Sandbox Code Playgroud)
并且没有消息到达。