Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  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 • 13 Jun 2018, 05:50
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 • 11 Jun 2018, 12:20
RE: Error handling

thanks @endel . I will try

posted in Questions & Help • 10 May 2018, 06:07
Error handling

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

posted in Questions & Help • 8 May 2018, 06:47
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 • 28 Apr 2018, 17:57
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 • 27 Apr 2018, 08:17
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 • 26 Apr 2018, 12:33
RE: Management system for server

@endel thank you very much

posted in Questions & Help • 17 Apr 2018, 11:31
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 • 16 Apr 2018, 07:07
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 • 12 Apr 2018, 08:54
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 • 5 Apr 2018, 13:53
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 • 5 Apr 2018, 06:10
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 • 4 Apr 2018, 07:27
RE: Room Error. (SOLVED)

@endel said in Room Error.:

es2016

works, thanks.

posted in Questions & Help • 3 Apr 2018, 13:30
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 • 3 Apr 2018, 11:37
RE: remove client

@endel said in remove client:

client

thanks

posted in Questions & Help • 22 Mar 2018, 14:38
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 • 22 Mar 2018, 11:02
RE: limit number for messages in chat (SOLVED)

@endel thanks

posted in Questions & Help • 14 Mar 2018, 15:38
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 • 14 Mar 2018, 12:54
RE: Problems in Internet Explorer 11 to client version (SOLVED)

thank you

posted in Questions & Help • 9 Mar 2018, 13:15

© 2023 Endel Dreyer