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. BlueBang
  3. Posts
  • Profile
  • More
    • Continue chat with BlueBang
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

Posts made by BlueBang

RE: Colyseus中文技术支持论坛

从0.10开始使用Colyseus的,现在能和creator官方合作也是极好的,开发者又多一个选着!点赞👍

posted in 中文 • 22 Aug 2021, 13:37
RE: Colyseus中文技术支持论坛

看我发现了什么😂

posted in 中文 • 22 Aug 2021, 13:26
RE: Hey All! I'm Luke

welcome😂

posted in Introduce Yourself • 6 Apr 2020, 08:11
RE: About Saving Room Data

@endel Thank you for your reply.But this method is called to return an object. How can I put the object into the database?use JSON.stringify?


//serverSide
onCreate(options) {
    //check if need restore
    if(true){
     let roomstate=getRoomStateFromDB();
     this.state=JSON.Parse(roomstate);// Is it used like this?
    }

}

async onDispose() {
    let roomtState=JSON.stringify(this.state.toJSON());
    storeDataBase(roomtState);// Is it used like this?
}



posted in Questions & Help • 2 Apr 2020, 09:18
RE: About Saving Room Data

There are many nested data in this root-state. It will be very cumbersome to assemble them when they are stored and used separately. Is there any way to save only root-state?

@endel Can you give me some advice?thank you.

posted in Questions & Help • 2 Apr 2020, 04:28
About Saving Room Data

Hi all,
In some cases, the room needs to be destroyed but the state information of the room needs to be recorded in the database so that the state can be restored next time.What do I need to do to implement this requirement? Do I serialize and deserialize directly?

posted in Questions & Help • 2 Apr 2020, 03:40
RE: Is there a way to disconnect a client by id from the server?
...
let playerList=new Map();//store player client info
async onAuth(Client client,options){
   
    if(validate(options.token){
    //if already joined
    if(playerList.get(options.token)){
          //disconnect old clients
          this.clients.foreach(oldClient){
            if(client.id==playerList.get(options.token)) oldClient.discontent();
         }
    }
        playerList.set(options.token,client.id,)
    }

}

...


posted in Questions & Help • 28 Mar 2020, 13:06
RE: Can't get basic client/server communication to work

hi,you should use matchMaker.defineRoomType to defind this room.

posted in Questions & Help • 28 Mar 2020, 12:56
Question About Client Disconnection

Hi all,
When I connect to the server and close WiFi, the server can receive the message quickly, but the client needs to wait about 50 seconds to receive the notice ofonLeave. This problem is the configuration problem or the lack of heartbeat detection? How can I fix it?
The client is JS version.

Thanks!

posted in Questions & Help • 15 Mar 2020, 13:16
RE: Can I remove one handle in OnMessage?

@endel Yes, it is. Haha, Cheers!

posted in Questions & Help • 7 Mar 2020, 14:28
Can I remove one handle in OnMessage?

Hi all,
In the document, only remove all listeners method.

posted in Questions & Help • 7 Mar 2020, 14:08
How to support sourse map

Hi all,
I am using typescript to debug the project in VS Code. My project has ts-nodeand source-map-support packages installed. But still can't display the correct number of error stack rows. Is my operation wrong or need other settings?
thanks!

e.g.
0_1583583024983_1583582995819.jpg

posted in Questions & Help • 7 Mar 2020, 12:13
RE: OnAuth Return CustomData

@endel yeah,Because it is still necessary to distinguish between system exceptions and business exceptions. My current solution is to add a formarter in the client-side.tanks for reply.😁

posted in Questions & Help • 6 Mar 2020, 16:14
OnAuth Return CustomData

Hi all,
The OnAuth method can only return the false value,right? What should I do if I want to return custom data after a validation failure?
Thanks.😁

for example:

 onAuth(client, options): Promise < any > {
    return new Promise((resolve, reject) => {
        let myData = {
            code: -1,
            reason: 'token is missing'
        }
        reject(myData);
    });
}

//other test
onAuth(client, options): Promise < any > {
    let myData={
        code: -1,
        reason: 'token is missing'
    }
    return myData;
}


//and the client side
client.joinOrCreate("test").then(room => {
}).catch(err => {
    //the err is null str
});

posted in Questions & Help • 6 Mar 2020, 08:19
RE: Connecting with colyseus in angular 7

Hi @garimabhasin ,I think maybe there is any mistake in your code, you post message is too little information. Did you used the sample project before? You can try.

posted in General Discussion • 4 Mar 2020, 14:54
How to install the branch of colyseus 0.13.0 in NPM

hi everyone,
this new feature is awesome, how to install 0.13 server side branch and generate *.d.ts file.
Thanks.

posted in Questions & Help • 3 Mar 2020, 07:44
RE: Limit the instance of rooms

@endel Great. I can learn something new again. Thank you for your reply.😁

posted in Questions & Help • 2 Mar 2020, 17:02
Limit the instance of rooms

Hi everyone.
Is there any way I can limited the client to add or create only one instance? Can I complete this requirement without modifying the framework? For example, I'm going to hold a competition. I want control to be created by the system, and I don't want players to create rooms.

I think of a way, but I don't think it's elegant enough.

//server side
let room=matchMaker.createRoom("match" {secret:OnlySystemKnowPassWord});

//client side
ws.joinOrCreate("match");//aways faild

Do you have any ideas? @endel thank you!

posted in Questions & Help • 2 Mar 2020, 16:26
RE: About The Same ClientID

Hi @endel thank you for report,
How to understand 'the sample client on multiple sessions', for example

//client
let ws= new Colyseus.Client("ws://localhost:2567")
ws.joinOrCreate("room");
ws.joinOrCreate("room");

//server
onAuth(client){
console.log(client.id) //the clientId will be same,right?
}

Thanks a million.

posted in Questions & Help • 29 Feb 2020, 03:30
About The Same ClientID

Hi @endel ,
It's said in the document that there will be the same ClientID when I connect to the same device twice. But it's not the same when I open two browser tabs for testing. Is my understanding wrong? Thank you

0_1582908323589_QQ20200229-004502@2x.png

posted in Questions & Help • 28 Feb 2020, 16:53

© 2023 Endel Dreyer