Navigation

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

    Best posts made by COCO

    RE: Why does Jest logs `TypeError: decode[type] is not a function` error while testing ?

    could you upload a piece of code that throw ing errors? Thanks.

    posted in Questions & Help •
    RE: Cross Origin Resource Policy error(sovled)

    Hi, Deiran!
    This is because your js file hosted by https server but you try to get it without https (maybe locally).
    You put you game into an https server and run it with your local browser, the error should gone.

    posted in Questions & Help •
    RE: Postinstall scripts are not being run(solved)

    Hi, I think you're right. When deployed on Arena Cloud your package.json file is not fully used by your deployment. Arena Cloud copies the custom dependencies into a managed Arena package.json which is then installed at the launch of your server. I'll find some way to help initialize the prisma.

    posted in Colyseus Arena - Cloud Hosting •
    RE: Which files from colyseus examples to upload to Arena?(solved)

    @chaimae

    0_1651835067385_a2154983-3f18-401a-83d5-5bc87a3ff156-image.png

    posted in Questions & Help •
    RE: deploy client project in arena(solved)

    @chaimae

    You're right and you are welcome. ❤️

    posted in Colyseus Arena - Cloud Hosting •
    RE: localPresence not working on Powered Ascent (PA)(solved)

    Please import RedisPresence from colyseus package, and replace your local presence (default) with redis presence.
    If you need some code, this is an example: https://github.com/CocosGames/ColyseusAudience/blob/master/src/arena.config.ts#L23
    Please note settings of old colyseus may have a little differences with the latest one.
    It's recommended that you test your project locally with redis presence and redis server before put it onto Arena.
    Here're some tools: https://discuss.colyseus.io/topic/589/再谈-redis-presence

    posted in Colyseus Arena - Cloud Hosting •
    RE: localPresence not working on Powered Ascent (PA)(solved)

    Unfortunately no, but the tools at the bottom of the topic are English.

    posted in Colyseus Arena - Cloud Hosting •
    RE: Get All the rooms instance(solved)

    Yes, https://docs.colyseus.io/colyseus/client/client/#getavailablerooms-roomname-string .

    posted in Questions & Help •
    RE: read ECONNRESET

    It looks like connection timeout caused by lots of clients at the same time. I'm asking the team what should we do if this happens.
    If the number of clients is big enough, timeout errors will happen sooner or later. Try to increase the timeout value or catch errors by your code.
    The server should serve how many clients at the same time is depend on your game design.
    Ther sever can serve how many clients at the same time is depend on the soft and hardware.

    posted in Questions & Help •
    RE: handl error when client recconect(SOLVED)

    @chaimae
    Hi,
    reference:

    1. https://docs.colyseus.io/colyseus/client/client/#reconnect-roomid-string-sessionid-string
      Usage - Colyseus & Arena Cloud Documentation
      Documentation for Colyseus Multiplayer Framework for Node.js
    2. https://docs.colyseus.io/colyseus/server/room/#allowreconnection-client-seconds
      Room - Colyseus & Arena Cloud Documentation
      Documentation for Colyseus Multiplayer Framework for Node.js
    3. https://github.com/colyseus/colyseus-unity3d/blob/master/Server/src/rooms/MyRoom.ts
      GitHub
      colyseus-unity-sdk/MyRoom.ts at master · colyseus/colyseus-unity-sdk

    server:

    async onLeave (client: Client, consented: boolean) {
      // flag client as inactive for other users
      this.state.players.get(client.sessionId).connected = false;
    
      try {
        if (consented) {
            throw new Error("consented leave");
        }
    
        // allow disconnected client to reconnect into this room until 20 seconds
        await this.allowReconnection(client, 20);
    
        // client returned! let's re-activate it.
        this.state.players.get(client.sessionId).connected = true;
    
      } catch (e) {
    
        // 20 seconds expired. let's remove the client.
        this.state.players.delete(client.sessionId);
      }
    }
    

    client:

        private void OnLeaveRoom(int code)
        {
            WebSocketCloseCode parsedCode = WebSocketHelpers.ParseCloseCodeEnum(code);
            LSLog.Log(string.Format("ROOM: ON LEAVE =- Reason: {0} ({1})", parsedCode, code));
            _pingThread.Abort();
            _pingThread = null;
            _room = null;
    
            if (parsedCode != WebSocketCloseCode.Normal && !string.IsNullOrEmpty(_lastRoomId))
            {
                JoinRoomId(_lastRoomId,null);
            }
        }
    
    posted in Questions & Help •