colyseus.js and Cocos Creator

how use colyseus.js in Cocos Creator ?

var Colyseus = require("colyseus");
cc.Class({
    extends: cc.Component,

    // use this for initialization
    onLoad: function () {
        var client = new Colyseus.Client('ws://localhost:2657');
    }
});

Colyseus == undefined

-1

Hey @colyseus, (you should pick another username btw, :sweat_smile:)

AFAIK, Cocos Creator doesn't play nice with NPM modules. So, you'd need to download and use the distribution file directly: https://github.com/gamestdio/colyseus.js/blob/master/dist/colyseus.js

Hope this helps! Cheers!

https://gitee.com/limo/simple_server

build with colyseus .js 0.9.33 version.