colyseus / colyseus.js

⚔ Colyseus Multiplayer SDK for JavaScript/TypeScript
https://docs.colyseus.io/getting-started/javascript-client/
MIT License
410 stars 107 forks source link

Error when host a game on HTTPS domain and connect to WSS socket server #102

Closed namnv09 closed 2 years ago

namnv09 commented 2 years ago

I host a client on HTTPS domain and connect to WSS socket endpoint. The joinOrCreate() function automatically add hostname to HTTP request

// hostname: https://game-host.com
const WEB_SOCKET_URL = "wss:/server-host.com" // endpoint
this.client = new Colyseus.Client(WEB_SOCKET_URL);
await this.client.joinOrCreate("room-name", options).then(room_instance => {
    this.setupListeners();
})

Error: POST https://game-host.com/server-host.com/matchmake/joinOrCreate/room-name Response 405

namnv09 commented 2 years ago

My bad, WEB_SOCKET_URL should be "wss://server-host.com"