Navigation

    Colyseus
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. lyh1091106900
    3. Posts
    • Profile
    • More
      • Continue chat with lyh1091106900
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Posts made by lyh1091106900

    RE: 关于本地环境下缩放单元测试可能遇到的席位过期问题

    感谢教程,有所帮助

    posted in 中文 •
    broadcast Mechanism Question

    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.
    the code follow :

    broadcast(typeOrSchema, messageOrOptions, options) {
        const isSchema = (typeof (typeOrSchema) === 'object');
        const opts = ((isSchema) ? messageOrOptions : options);
        if (opts && 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);
            }
        }
    }
    posted in General Discussion •
    RE: Colyseus中文技术支持论坛

    问题一:如果部署在两台机器上,服务器代码和单机会有怎样的区别。
    问题二:单机的单进程模式切换成多进程模式是否只要将设置duoRedisPresence,然后修改数据库模块。设置duoRedisPresence服务器是否会自动根据负载新增服务器进程,无需额外编写代码。如果服务器新增进程是copy一份新的app,还是只是处理Room的逻辑

    posted in 中文 •