【问题标题】:Socket.io, Redis Store and IESocket.io、Redis Store 和 IE
【发布时间】:2011-12-20 17:03:27
【问题描述】:

我有一个使用 Redis、Socket.io 的游戏,有 2 个运行 diff socket.io 客户端的 nodejs 服务器。我通过 redis 存储与两个 socket.io 客户端进行通信,这样我可以随时向所有套接字发出。它有效。

io.sockets.emit('successful_connection', { success : true }); return;

我的问题是,当 ie 通过 id 调用特定套接字时,它会失败。

io.sockets.socket(socketId).emit('successful_connection', { success : true }); return;

我不知道为什么,它适用于所有其他浏览器。这是socket.io/redis store config的代码

    io.configure(function(){
        var RedisStore = require('socket.io').RedisStore,
            opts = {host: **.***.**.**, port: ****};
        io.set('store', new RedisStore({redisPub:opts, redisSub:opts, redisClient:opts}));
    });     

任何建议都会有所帮助,现在我的主要想法是“为什么要有 nodejs/socket.io 服务器”。如果我必须处理这个问题,真的有好处吗?谢谢

【问题讨论】:

  • 您提到“有 2 个 nodejs 服务器运行 diff socket.io 客户端”,那么它们是否连接到 socket.io 服务器?如果这是错误的,您能否确保不要互换使用“客户端”和“服务器”这两个词?它们的意思不同,因此无法理解正在发生的事情。

标签: node.js redis socket.io


【解决方案1】:

This 带有示例代码的博客文章可能会对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-15
    • 1970-01-01
    • 1970-01-01
    • 2016-05-25
    • 1970-01-01
    • 2012-10-11
    • 2012-11-09
    • 2012-03-07
    相关资源
    最近更新 更多