Navigation

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

    Posts made by rscata

    RE: Timer

    @plyoung thanks

    posted in Questions & Help •
    Timer

    If a player does not make a decision in 30 seconds, how could I generate an action?

    for example in a board game, if it does not move the piece, the server automatically moves the piece.

    posted in Questions & Help •
    RE: Error handling

    thanks @endel . I will try

    posted in Questions & Help •
    Error handling

    Is there a way to handling all the errors and send them to me via email?
    Thanks.

    posted in Questions & Help •
    RE: onLeave timeout

    Thanks @endel

    Yes, this solution is good not to close the room, if there is no player in the room, but if in a room I have 5 players who play for example poker and by mistake one of them leave the room, how can I set an interval in which to return to the game room?
    Should I set a timeout for each client?

    I want to have 30 sec. to return to the room.

    Or, for example, if refresh on the browser page.

    In onLeave function, I implemented the destruction of the player instance, but I would like to give her some time to come back before destroying the instance.

    onLeave () {
        if (this.clients.length === 0) {
          setTimeout(() => this._disposeIfEmpty(), 5000);
        } else {
              // TODO: the player can return to play
    
              // remove instance
              this.state.removePlayer(client);
        }
      }
    

    thank you very much for your help

    posted in Questions & Help •
    onLeave timeout

    on server side, when player leave room, you can set a time out to avoid session destroying for few seconds if he wants to return?

    posted in Questions & Help •
    RE: Browser support?

    From what I tested:

    • IE8 - does not support ws
    • IE11 - works
    • iOS 7 does not support msgpack
    • IOS 9 - works
    • Opera 22.x does not support ws
    • Opera 33.x - works
    • Android 6.0 - works
    posted in Questions & Help •
    RE: Management system for server

    @endel thank you very much

    posted in Questions & Help •
    RE: Management system for server

    I have not yet done, if i'm going to do i will announce you.

    Thank you
    Have a nice day

    posted in Questions & Help •
    Management system for server

    What method would be for the server to perform certain actions in a room (send users message, kick user, ..) depending on certain triggered events?

    I was thinking of solitude by using a list system, like Redis for example, but I just do not know if it's optimal, like if I had 1000 rooms, it would mean having 1000 lists, one for each room.

    As a management system for the server.

    Thanks

    posted in Questions & Help •
    RE: onAuth async Error (SOLVED)

    I found the problem. The problem was from me when I encode the token.

    Sorry, and thank you

    posted in Questions & Help •
    RE: onAuth async Error (SOLVED)

    Hi @endel

    I put some console.log for debug.

    async onAuth (options) {
    
            console.log(1);
    
            let authInst = new Auth();
    
            if (undefined != options.tocken && !_.isEmpty(options.tocken)) {
                console.log(2);
                const response = await authInst.checkLogin(options.tocken, this.roomName);
                if (!_.isEmpty(response) && !_.isEmpty(response[0]) && !_.isEmpty(response[0].username)) {
                    console.log(3);           
                    return true;
                } else {
                    console.log(4);
                    return false;
                }
            } else {
                console.log(5);
                debug.errorRoomChat("onAuth: undefined tocken %O", options);
            }
            console.log(6);
            return false;
        }
    

    When it works well, the output is 1,2 and 3 , and when it does not work ok, the output is 1 and 2.
    With the same user I tried, I just refreshed the page and sometimes work and sometimes not.

    checkLogin(tocken:string, roomName:string) {
    // some validations
    
    return new Promise((resolve, reject) => {
       // db query 
    
      // if ok 
      return resolve(result)
    
     // if err
      return reject(err)
    }
    }
    

    With verifyClient function it works perfect.

    I use v9.9.0 node version

    posted in Questions & Help •
    onAuth async Error (SOLVED)

    Since I upgraded to 0.9.1 and I changed the verifyClient function to onAuth function, sometimes I need to try to connect to the server several times before I succeed.

    The client-side error is:
    Firefox can not establish a connection to the server at ws: // localhost: 8080 / BJlPioxfjG? Colyseusid = H1F7jl-9M & channel = sah & tocken = JbFDLDmpKLzx1LWxdTQNqdp09B8BmNc6maz0CGIOYPo3Ltnp1p + ojmOdpM6dwhB5 & requestId = 1. colyseus.js: 1: 31 251 Possible causes: room's onAuth () failed or maxClients has been reached.

    maxClients I did not initialize it.

    With verifyClient function it works perfect.

    Code:

    async onAuth (options) {
    
            let authInst = new Auth();
    
            if (undefined != options.tocken && !_.isEmpty(options.tocken)) {
                const response = await authInst.checkLogin(options.tocken, this.roomName);
                if (!_.isEmpty(response) && !_.isEmpty(response[0]) && !_.isEmpty(response[0].username)) {
                    debug.infoRoomChat("onAuth: ok, tocken %O", options);
                    return true;
                } else {
                    debug.errorRoomChat("onAuth: invalid tocken %O", options);
                    return false;
                }
            } else {
                debug.errorRoomChat("onAuth: undefined tocken %O", options);
            }
            return false;
        }
    

    Thanks.

    posted in Questions & Help •
    RE: Room Error. (SOLVED)

    @endel said in Room Error.:

    es2016

    works, thanks.

    posted in Questions & Help •
    Room Error. (SOLVED)

    I upgrade to 0.9.1, and I have this problem:

    TypeError: Class constructor Room cannot be invoked without 'new'

    where I got the error:
    export class ChatRoom extends Room {

    Can you help me ?
    Thank you

    posted in Questions & Help •
    RE: remove client

    @endel said in remove client:

    client

    thanks

    posted in Questions & Help •
    remove client

    On the server, how can I remove a specific client?

    For example, if I try to enter from another browser, I want to delete it (close the connection) for the old browser.

    Thanks.

    posted in Questions & Help •
    RE: limit number for messages in chat (SOLVED)

    @endel thanks

    posted in Questions & Help •
    limit number for messages in chat (SOLVED)

    How cand I limit the number of messages from a chat room.

    I try to shift splce, but then it does not do the sync ok.

    posted in Questions & Help •
    RE: Problems in Internet Explorer 11 to client version (SOLVED)

    thank you

    posted in Questions & Help •