<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[broadcast Mechanism Question]]></title><description><![CDATA[<p>All I know is in colyseus sever different player can live in different proccessId sever，with redispresence they can communicate。when I read soucecode in Room.ts about broadcast,I find it just sent message to clients of Room instance,I think Room instance is totally Independent of other proccessId sever。so it is confuse for me that  without ipc call how can I call make a broadcast to send mssage to everyone.<br />
the code  follow :</p>
<pre><code>broadcast(typeOrSchema, messageOrOptions, options) {
    const isSchema = (typeof (typeOrSchema) === 'object');
    const opts = ((isSchema) ? messageOrOptions : options);
    if (opts &amp;&amp; opts.afterNextPatch) {
        delete opts.afterNextPatch;
        this._afterNextPatchQueue.push(['broadcast', arguments]);
        return;
    }
    if (isSchema) {
        this.broadcastMessageSchema(typeOrSchema, opts);
    }
    else {
        this.broadcastMessageType(typeOrSchema, messageOrOptions, opts);
    }
}

broadcastMessageSchema(message, options = {}) {
    const encodedMessage = Protocol.getMessageBytes[Protocol.Protocol.ROOM_DATA_SCHEMA](message);
    let numClients = this.clients.length;
    while (numClients--) {
        const client = this.clients[numClients];
        if (options.except !== client) {
            client.enqueueRaw(encodedMessage);
        }
    }
}
broadcastMessageType(type, message, options = {}) {
    const encodedMessage = Protocol.getMessageBytes[Protocol.Protocol.ROOM_DATA](type, message);
    let numClients = this.clients.length;
    while (numClients--) {
        const client = this.clients[numClients];
        if (options.except !== client) {
            client.enqueueRaw(encodedMessage);
        }
    }
}</code></pre>
]]></description><link>http://discuss.colyseus.io/topic/571/broadcast-mechanism-question</link><generator>RSS for Node</generator><lastBuildDate>Mon, 14 Sep 2026 02:33:55 GMT</lastBuildDate><atom:link href="http://discuss.colyseus.io/topic/571.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Feb 2022 03:03:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to broadcast Mechanism Question on Invalid Date]]></title><description><![CDATA[<p>All I know is in colyseus sever different player can live in different proccessId sever，with redispresence they can communicate。when I read soucecode in Room.ts about broadcast,I find it just sent message to clients of Room instance,I think Room instance is totally Independent of other proccessId sever。so it is confuse for me that  without ipc call how can I call make a broadcast to send mssage to everyone.<br />
the code  follow :</p>
<pre><code>broadcast(typeOrSchema, messageOrOptions, options) {
    const isSchema = (typeof (typeOrSchema) === 'object');
    const opts = ((isSchema) ? messageOrOptions : options);
    if (opts &amp;&amp; opts.afterNextPatch) {
        delete opts.afterNextPatch;
        this._afterNextPatchQueue.push(['broadcast', arguments]);
        return;
    }
    if (isSchema) {
        this.broadcastMessageSchema(typeOrSchema, opts);
    }
    else {
        this.broadcastMessageType(typeOrSchema, messageOrOptions, opts);
    }
}

broadcastMessageSchema(message, options = {}) {
    const encodedMessage = Protocol.getMessageBytes[Protocol.Protocol.ROOM_DATA_SCHEMA](message);
    let numClients = this.clients.length;
    while (numClients--) {
        const client = this.clients[numClients];
        if (options.except !== client) {
            client.enqueueRaw(encodedMessage);
        }
    }
}
broadcastMessageType(type, message, options = {}) {
    const encodedMessage = Protocol.getMessageBytes[Protocol.Protocol.ROOM_DATA](type, message);
    let numClients = this.clients.length;
    while (numClients--) {
        const client = this.clients[numClients];
        if (options.except !== client) {
            client.enqueueRaw(encodedMessage);
        }
    }
}</code></pre>
]]></description><link>http://discuss.colyseus.io/post/1721</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1721</guid><dc:creator><![CDATA[lyh1091106900]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to broadcast Mechanism Question on Invalid Date]]></title><description><![CDATA[<p>Hi, I think you need presence:</p>
<p><img src="/assets/uploads/files/1647254466466-38e4f669-9742-4ea9-8202-13f3594b9818-image-resized.png" alt="0_1647254457032_38e4f669-9742-4ea9-8202-13f3594b9818-image.png" class="img-responsive img-markdown" /></p>
<p><a href="https://docs.colyseus.io/colyseus/server/presence/" rel="nofollow">https://docs.colyseus.io/colyseus/server/presence/</a></p>
]]></description><link>http://discuss.colyseus.io/post/1771</link><guid isPermaLink="true">http://discuss.colyseus.io/post/1771</guid><dc:creator><![CDATA[COCO]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>