【问题标题】:Sails v0.10.x not sending update or addedTo messages when in Production ModeSails v0.10.x 在生产模式下不发送更新或添加到消息
【发布时间】:2014-08-10 16:25:29
【问题描述】:

我在生产模式下遇到了 Sails WebSockets 的问题。当我在开发模式下运行 Sails 时 - 即 sails lift - 我收到了消防软管上的所有消息。但是,当我在生产模式下运行 Sails 时 - 即 sails lift --prod - 我只收到创建消息。

例如,我的套接字侦听器代码如下所示:

io.socket.get('/firehose', function nowListeningToFirehose(message) {

    // Attach a listener which fires every time the server publishes
    // a message to the firehose, then dispatch messages to simple handlers
    io.socket.on('firehose', function newMessageFromSails(message) {
        console.log('Firehose message: ', message);

        switch (message.model) {

            // Handle messages related to Rooms
            case 'room':
                processRoomMessage(message);
                break;

            // Handle messages related to Person(s)
            case 'person':
                processPersonMessage(message);
                break;

            default:
                break;

        }
    });

当我在开发模式下运行时,我会收到 updateaddedTo 房间消息。我还收到createupdate 个人消息。但是,当我在生产模式下运行时。我只收到用户的create 消息,没有updateaddedTo 消息。

我正在运行 Sails v.0.10.2。

【问题讨论】:

    标签: sails.js sails.io.js


    【解决方案1】:

    好的。根据来自 Sails 的以下日志消息,消防软管在生产模式下已关闭。

    Warning: A client socket was just subscribed to the firehose, but the environment is set to `production`. Firehose messages are only delivered in the development environment.
    

    它没有解释为什么我收到create 消息,但至少解释了为什么我没有收到updateaddedTo 消息。

    【讨论】:

      【解决方案2】:

      看起来 Sails pubsub 实现中存在一个错误,导致在 publishCreate 调用时发送 firehose 消息。现在正在修补。正如您在警告中看到的(和stated in the documentation 一样,firehose 严格用作开发工具。感谢您的报告!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-04-03
        • 2016-12-10
        • 1970-01-01
        • 2021-08-05
        • 2019-12-22
        • 1970-01-01
        • 1970-01-01
        • 2014-06-23
        相关资源
        最近更新 更多