GitHub Documentation Patreon donate button

Connecting with colyseus in angular 7



  • Hello,
    I am new to colyseus. I am writing client end code in Angular 7 and failing to connect with server.
    Below is the code I have written in my client side component ts file -

    import {Client, Room} from 'colyseus.js';

    export class AppComponent implements OnInit {
    private chatRoom: Room;

    ngOnInit(): void {
    var client = new Client('ws://localhost:3553');
    console.log("client ", client);

    this.chatRoom = client.join('gameplay', {channel: 'Default'});
    

    }
    }

    I am getting null in 'id' key for client instance log.
    And getting the following error on server end code -

    Error: seat reservation expired.
    at WebSocketServer.<anonymous> (E:\Kijana\config\node_modules\colyseus\lib\transport\WebSocketTransport.js:101:27)
    at Generator.next (<anonymous>)
    at E:\Kijana\config\node_modules\colyseus\lib\transport\WebSocketTransport.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (E:\Kijana\config\node_modules\colyseus\lib\transport\WebSocketTransport.js:4:12)
    at WebSocketServer.onConnection (E:\Kijana\config\node_modules\colyseus\lib\transport\WebSocketTransport.js:83:16)
    at emitTwo (events.js:126:13)
    at WebSocketServer.emit (events.js:214:7)
    at handleUpgrade (E:\Kijana\config\node_modules\ws\lib\websocket-server.js:98:18)
    at WebSocketServer.completeUpgrade (E:\Kijana\config\node_modules\ws\lib\websocket-server.js:331:5)



  • 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.


 

© 2020 Endel Dreyer