Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. erochOnGit
erochOnGit

erochOnGit

@erochOnGit

Chat Follow Unfollow
0
Reputation
7
Posts
1.8k
Profile views
0
Followers
0
Following
Joined 7 Jun 2018, 06:33 Last Online 28 Jun 2018, 15:47

  • Profile
  • More
    • Continue chat with erochOnGit
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups
erochOnGit Follow

Posts made by erochOnGit

RE: colyseus.js: server error: registeredHandler.klass is not a constructor

@endel said in colyseus.js: server error: registeredHandler.klass is not a constructor:

Or by exporting the room usin

I'll try it the week end and come back to you later.
Thx for the help so far.

posted in Questions & Help • 22 Jun 2018, 15:53
RE: colyseus.js: server error: registeredHandler.klass is not a constructor

@diederik-van-remoortere

You must use typescript, I tried with babel but it was wrong.
In my repo I forgot to remove babel from the package.json

posted in Questions & Help • 22 Jun 2018, 15:50
RE: colyseus.js: server error: registeredHandler.klass is not a constructor

Sorry for the late reply!

I just finished a project where i'm able to run client but having .klass issue ...

please use develop branch

here it is :
https://github.com/erochOnGit/nodeGame

If you are not able to run it properly tell me i'll help you

posted in Questions & Help • 20 Jun 2018, 12:11
RE: colyseus.js: server error: registeredHandler.klass is not a constructor

@endel i did this it's not correct ?

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "noImplicitAny": false,
    "sourceMap": true,
    "outDir": "build"
  },
  "exclude": [
    "node_modules",
    "**/*.spec.ts",
    "**/*.test.ts"
  ],
  "include": [
    "src/**/*.ts"
  ]
}

EDIT : I have the same error when i add "target": "es2015", to my tsconfig.json.

posted in Questions & Help • 8 Jun 2018, 14:40
colyseus.js: server error: registeredHandler.klass is not a constructor

Hi there ! I finally succeed at running my server and my client with webpack and typescript ... but now i have a wierd error in chrome :

colyseus.js: server error: registeredHandler.klass is not a constructor

Does any one know what is it and where is it from...

I googled it and i found NOTHING it's scare me a lot ...

posted in Questions & Help • 8 Jun 2018, 08:41
RE: I would like to run colyseus using webpack but it's not working :/ (solved)

I found the problem by myself ... -_- i was using colyseus server side

posted in Questions & Help • 7 Jun 2018, 07:33
I would like to run colyseus using webpack but it's not working :/ (solved)

Hello it's my first topic here if there is rules don't hesitate to tell me :

I'm compiling my react with webpack but i would like to add colyseus ...

I run it on server side it's ok ... but when i add it to the client side it's crashing :

import React, { Component } from "react";
import ReactDOM from "react-dom";
import * as Colyseus from "colyseus"

class Salut extends Component {
    constructor(props) {
        super(props)

        this.state = {
            clientId: null
        }
    }

    componentDidMount() {
        this.client = new Colyseus.Client('ws://localhost:4000')
        this.room = this.client.join('room')

        this.setState({
            clientId: this.client.id
        })
    }

    render() {
        const { clientId } = this.state

        return (
            <div>
                Salut {clientId} !
            </div>
        )
    }
}



ReactDOM.render(
    <Salut />,
    document.getElementById("app")
);

here is my stack :


    WARNING in ./node_modules/ws/lib/buffer-util.js
    Module not found: Error: Can't resolve 'bufferutil' in '/project/node_modules/ws/lib'
     @ ./node_modules/ws/lib/buffer-util.js 56:21-42
     @ ./node_modules/ws/lib/sender.js
     @ ./node_modules/ws/index.js
     @ ./node_modules/colyseus/lib/Server.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    WARNING in ./node_modules/ws/lib/validation.js
    Module not found: Error: Can't resolve 'utf-8-validate' in '/project/node_modules/ws/lib'
     @ ./node_modules/ws/lib/validation.js 4:22-47
     @ ./node_modules/ws/lib/sender.js
     @ ./node_modules/ws/index.js
     @ ./node_modules/colyseus/lib/Server.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/memshared/lib/index.js
    Module not found: Error: Can't resolve 'cluster' in '/project/node_modules/memshared/lib'
     @ ./node_modules/memshared/lib/index.js 6:14-32
     @ ./node_modules/colyseus/lib/presence/MemsharedPresence.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/redis-parser/lib/hiredis.js
    Module not found: Error: Can't resolve 'hiredis' in '/project/node_modules/redis-parser/lib'
     @ ./node_modules/redis-parser/lib/hiredis.js 3:14-32
     @ ./node_modules/redis-parser/lib/parser.js
     @ ./node_modules/redis-parser/index.js
     @ ./node_modules/redis/index.js
     @ ./node_modules/colyseus/lib/presence/RedisPresence.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/redis/index.js
    Module not found: Error: Can't resolve 'net' in '/project/node_modules/redis'
     @ ./node_modules/redis/index.js 3:10-24
     @ ./node_modules/colyseus/lib/presence/RedisPresence.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/ws/lib/websocket.js
    Module not found: Error: Can't resolve 'net' in '/project/node_modules/ws/lib'
     @ ./node_modules/ws/lib/websocket.js 7:12-26
     @ ./node_modules/ws/index.js
     @ ./node_modules/colyseus/lib/Server.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/redis/index.js
    Module not found: Error: Can't resolve 'tls' in '/project/node_modules/redis'
     @ ./node_modules/redis/index.js 4:10-24
     @ ./node_modules/colyseus/lib/presence/RedisPresence.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

    ERROR in ./node_modules/ws/lib/websocket.js
    Module not found: Error: Can't resolve 'tls' in '/project/node_modules/ws/lib'
     @ ./node_modules/ws/lib/websocket.js 8:12-26
     @ ./node_modules/ws/index.js
     @ ./node_modules/colyseus/lib/Server.js
     @ ./node_modules/colyseus/lib/index.js
     @ ./src/web/index.js
     @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/web/index.js

and here my webpack file :

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const NodeExternals = require("webpack-node-externals");

const universalRules = [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: {
      loader: "babel-loader",
      options: {
        presets: ["@babel/preset-env", "@babel/react"]
      }
    }
  }
];

module.exports = [
  {
    mode: "development",
    entry: "./src/web/index.js",
    output: {
      filename: "bundle.js",
      path: path.resolve(__dirname, "build")
    },
    plugins: [
      new HtmlWebpackPlugin({
        template: "src/index.html"
      })
    ],
    module: {
      rules: [...universalRules]
    },
    devServer: {
      contentBase: "./build",
      host: "0.0.0.0",
      disableHostCheck: true
    }
  }
];

I hope there is a way to fix it else i'll just open a bug on github ... it should be help full

posted in Questions & Help • 7 Jun 2018, 06:45

© 2023 Endel Dreyer