Skip to content

ERROR: Cocos Creator 3.8.2 and colyseus.js 0.15 #141

Open
@human211

Description

@human211

when I launch it in the browser everything is ok. but if I run it in the simulator, it’s an error. Therefore, the connection to the server is not created and the game does not start.

import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
import Colyseus from 'db://colyseus-sdk/colyseus.js';

ccclass('test')
export class test extends Component {
    start () {
        this.client = new Colyseus.Client('ws://localhost:2567');
    }
}

LOG:

10:44:49 [ERROR]: JS: TypeError: Cannot read properties of undefined (reading 'toLowerCase')
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at new <anonymous> (jsb-adapter/web-adapter.js:350:35)
    at new Client (http://192.168.1.100:7456/scripting/x/chunks/06/06cb93b53c4faf511f8419cd7b43f5ca107a4e76.js:6151:27)
    at test.start (http://192.168.1.100:7456/scripting/x/chunks/3f/3fed73c55abf94efb7af37eb78a375e40c473aca.js:63:25)
    at eval (eval at createInvokeImplJit (src/cocos-js/builtin-res-mgr.jsb-782de3de.js:8047:69), <anonymous>:3:65)
    at OneOffInvoker._invoke (src/cocos-js/builtin-res-mgr.jsb-782de3de.js:8054:19)
    at OneOffInvoker.invoke (src/cocos-js/builtin-res-mgr.jsb-782de3de.js:7998:22)
    at ComponentScheduler.startPhase (src/cocos-js/builtin-res-mgr.jsb-782de3de.js:8161:35)
    at Director.tick (src/cocos-js/director-cf2afd11.js:1477:41)
    at Game._updateCallback (src/cocos-js/deprecated-88c49970.js:1080:28)
    at src/cocos-js/deprecated-88c49970.js:140:26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions