Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. jack1604
    J

    jack1604

    @jack1604

    Chat Follow Unfollow
    3
    Reputation
    9
    Posts
    1200
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with jack1604
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    jack1604 Follow

    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 •
    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 •
    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 •
    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 •
    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 •
    listen event disconnect on client and server

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

    posted in Questions & Help •
    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 •
    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 •
    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 •