Succeded! Thanks very much!
Posts made by Michaelbest1
Hi. I have to deploy my server to a platform that only allows https. I find the following doc: https://docs.colyseus.io/deployment/#nginx-recommended
but I still don't know how to start the server because I'm starting just by executing comand npm start and the entry script is index.ts.
Can anyone help me? Thanks!
Hi. Do you use nginx and pm2 for deployment? If so, how could you pack your web app and start it?
Hi @endel
It WORKS! Thanks a lot!
I learned just now that there're several ways of packing js. And maybe umd is suitable for CommonJS mentioned by @parkcd. So please use this way for future pack : )
Hi @endel
Thanks for your replay. Of course I've updated both server and client to latest version. The hash I shown is just the version that the dist file changed.
I'm sorry that I'm not professional on JS. I've tried import, require and without any import but none of them works. If I use this:
var Colyseus = require("colyseus");
The error message is:
ColyClient.js:16 Uncaught TypeError: Cannot read property 'Client' of undefined
And if without any importing, the error message is:
Colyseus is not defined
The runtime of cocos creator is different from web browser. I think there is no global scope at all. If you want to use any module in js or ts, you have to import it or require it.
So could you try cocos creator and find a solution? Thanks very much!
I have been using colyseus very well for a long time in Cocos Creator by importing dist/colyseus.js in my project. But recently when I updated it, both server and client, the client gave me error:
Uncaught TypeError: Colyseus.Client is not a constructor
And my code is the same with offical document:
import * as Colyseus from "colyseus.js";
var client = new Colyseus.Client('ws://localhost:2657');
I checked file dist/colyseus.js and found it has changed a lot, which is seemed to be compiled and in just one line. The change ID is c4063f63ebfc4aadf39254d611ae8c81406ac203.
I want to use consent argument in sever side for callback onLeave() so I have to update it.
Can anyone help me? Thanks very much!