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

Posts made by jack1604

WebSocketSharp Error!An exception has occurred while receiving a message.

Hello
when i run unity example, i connect to my server, my server use Colyseus 0.9.24
but Unity get error "WebSocketSharp Error!An exception has occurred while receiving a message."
"WebSocketSharp Close!An exception has occurred while receiving a message.Code:1006"
what problem here?
Please help

posted in Questions & Help • 4 Jan 2019, 14:51
RE: How create room with different MaxClients in client-side?

i think you need send options max client to server
Example:
1.client
client.join("chat", {max_client:max_client});
2.server
onInit(options) {

var max_client = options.max_client;
this.maxClients= max_client;

}

posted in Questions & Help • 30 Dec 2018, 14:35
create room instance on server

Hello,
i want to create some room instance on server, how to?
i dont want to create room when client call join event, i only want to join room with room id by get list available room
thanks

posted in Questions & Help • 29 Dec 2018, 10:53
RE: listen event disconnect on client and server

@endel said in listen event disconnect on client and server:

Hi @jack1604, that's a good question, the client reference you're using on this.send() is the one that has been disconnected. The new - reconnected - client will be returned from the allowReconnection() method.

Example:

try {
    const reconnectedClient = await this.allowReconnection(client, 20);
    this.send(reconnectedClient, reconnectedClient.sessionId + ' rejoined');
} catch (e) {
    console.log(e);
}

Hope this helps! Cheers!

hello,
if client disconnect or leave room , it will receive event on room.leave(), how to detect it is disconnect or leave room? because if client is disconnected, client will rejoin. if client leave room, client will not rejoin.

posted in Questions & Help • 29 Dec 2018, 01:03
RE: listen event disconnect on client and server

@endel said in listen event disconnect on client and server:

Hi @jack1604,

From client-side: http://colyseus.io/docs/client-room/#onleave
From server-side: http://colyseus.io/docs/api-room/#onleave-client-consented

Cheers!

thanks,
when client rejoin success full, server will send a message, but if server send broadcast client will receive, if server send by method send, client will not receive
what the problem?

this is my code:

async onLeave (client, consented) {
var room = this;
console.log(new Date()," onLeave client.sessionId:", client.sessionId, ' consented:', consented);
this.broadcast(${ client.sessionId } left.);
if(!consented){
client.active = false;
try {
await this.allowReconnection(client, 20);
client.active = true;
this.broadcast(client.sessionId + ' rejoined');// client will receive
this.send(client, client.sessionId + ' rejoined'); // client not receive
} catch (e) {
console.log(e);
}
}
}

posted in Questions & Help • 27 Dec 2018, 03:05
listen event disconnect on client and server

Hello,
How to to listen event disconnect on client and server?

posted in Questions & Help • 26 Dec 2018, 03:17
a user login 2 device

hello,
i want to close old connection when 1 user login on 2 device
My mean is:
onAuth (options){
return true;
}

requestJoin (options: any, isNew: boolean) {
return true;
}

onJoin (client) {
if(userId in this.players){
var old_client = this.players[userId];
old_client.close();
}
this.players[userId] = client;
}
How to do this?

posted in Questions & Help • 25 Dec 2018, 08:29
RE: client dont have session id when join with room id

@anubiscode
This is my log:
+Client 1 join by room "chat":
onJoin - clientId:77PVXQ9YI ssId:b9qJ3wBfy
+Client 2 join by room id which created by client 1:
onJoin - clientId:77PVXQ9YI ssId:undefined

posted in Questions & Help • 25 Dec 2018, 06:41
client dont have session id when join with room id

hello,
i have 2 client, client 1 join use code: client.join("chat");
client 2 get available room, client 2 join use code: client.join(room_id);
client 1 have session id on server, but client dont have a session id
how to fix?
thanks

posted in Questions & Help • 25 Dec 2018, 04:36

© 2023 Endel Dreyer