Hello,
Trying to figure out how to use Nakama with cocos creator 3.3. I’m following the guide: JavaScript - Heroic Labs Documentation. When I preview in cocos, this error comes up.
[preview-error]unhandledrejection: (intermediate value)(intermediate value)(intermediate value) is not a constructor
[preview-error]TypeError: (intermediate value)(intermediate value)(intermediate value) is not a constructor
at _callee$ (http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:70:30)
at tryCatch (http://localhost:7456/scripting/polyfills/bundle.js:12585:20)
at Generator.invoke [as _invoke] (http://localhost:7456/scripting/polyfills/bundle.js:12804:25)
at Generator.prototype.<computed> [as next] (http://localhost:7456/scripting/polyfills/bundle.js:12638:24)
at asyncGeneratorStep (http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:6:105)
at _next (http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:8:196)
at http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:8:366
at new Promise (<anonymous>)
at HelloWorld.<anonymous> (http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:8:99)
at HelloWorld.connect (http://localhost:7456/scripting/x/mods/fs/0/assets/scripts/HelloWorld.js:86:29)
- Versions: windows, nakama-js v2.3.0
This is the only component I have attached in the scene.
import { Client,Session,Socket } from '@heroiclabs/nakama-js';
@ccclass('HelloWorld')
export class HelloWorld extends Component {
start(){
this.connect();
}
async connect () {
const client:Client = new Client("defaultkey");
}
}