Skip to content

broadcasting through omega-supreme only works on the same process #6

@siddo420

Description

@siddo420

this could possibly be a documentation bug or perhaps am doing something wrong.

through my tests, it was revealed that the broadcast messages are only sent to clients connected to the same node process and not to the "cluster" as is mentioned in the documentation.

Here is whats written: "Broadcast a message to all sparks in the cluster."

I tested by using two node processes behind HAProxy. I fired up two browser sessions and made sure clients were connected to separate node processes. I sent messages and only received them back on the sender but the other client that was connected to the other node process did not receive anything.

I killed one of the node processes and forced the client connected to it to use the other node process (behind HAProxy). This time I could see that messages were received on both clients (because both were connected to the same process now).

The code I used to broadcast message is:

                primus.forward.broadcast( data.message, function (err, result) {
                  logger.debug("In send message: " + JSON.stringify( result ) + 
                                         " error: " + JSON.stringify( err ));
                });

The debug line returned (after a few minutes of sending message).

debug: In send message: [null] error: {"code":"ECONNRESET","url":"http://192.168.1.9:3000/primus/omega/supreme","status":500,"body":{},"type":"broadcast","packet":{"sparks":"","msg":"hello"}}

Its the same error object that is returned no matter if the messages were delivered or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions