Cocos Creator 3.8.7
Colyseus 0.16.9
When Cocos Creator builds a WeChat mini-game, it cannot connect to the WebSocket server
async connect() {
try {
console.log("connecting to Colyseus..."); // console have this log
this.room = await this.client.joinOrCreate("my_room");
console.log("joined successfully!"); // console not this log
console.log("user's sessionId:", this.room.sessionId);
this.room.onStateChange((state) => {
console.log("onStateChange: ", state);
});
this.room.onLeave((code) => {
console.log("onLeave:", code);
});
} catch (e) {
console.error("Error connecting to Colyseus:", e);
}
}
