Giter Site home page Giter Site logo

colyseus / colyseus-examples Goto Github PK

View Code? Open in Web Editor NEW
175.0 175.0 89.0 214 KB

Examples for learning how Colyseus works

Home Page: https://examples.colyseus.dev/

License: MIT License

HTML 70.82% TypeScript 27.84% JavaScript 1.34%
colyseus hacktoberfest hacktoberfest2023 multiplayer networking websockets

colyseus-examples's People

Contributors

atharvashukla avatar dylanjaide avatar endel avatar federkun avatar ianmayo avatar lucidsight avatar nicoweio avatar oskarer avatar sandrosc avatar seiyria avatar sergeybazhaykin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colyseus-examples's Issues

Live demo server timing out

Looks like all the live demos aren't getting the expected response from the server.
(for example the post request within createMatchMakeRequest() in 01-chat)
image

Request to https://examples.colyseus.dev/matchmake/joinOrCreate/chat gets the below response after 31.5 seconds:

{"code":4213,"error":"connection <monitor> to 10.100.xxx.xxx:61001 timed out"}

Facebook API refuses OAuth when called from HTTP

Description

chrome console gives this error

The method FB.login will soon stop working when called from http pages. Please update your site to use https for Facebook Login. https://developers.facebook.com/blog/post/2018/06/08/enforce-https-facebook-login/

login example not working

I run colyseus examples on glitch (free NodeJS hosting), it works fine.
But the auth example is puzzling me, I get:
image
Additionally, I see a token in clear in the code. I guess it should be in .env file
I also tried in FF (where my facebook cookie is) and it throws another error:
image

Type 'Server' has no properties in common with type 'Partial<MonitorOptions>'.

I've been unable to run this example by following the instructions in the readme.

git clone https://github.com/colyseus/colyseus-examples.git
cd colyseus-examples
npm install
npm start

I get the error:

TSError: ⨯ Unable to compile TypeScript:
index.ts:45:30 - error TS2559: Type 'Server' has no properties in common with type 'Partial<MonitorOptions>'.

45 app.use('/colyseus', monitor(gameServer));

In index.ts, the following imports didn't have type definitions (until I installed the @types/* packages for each of them, but that didn't help.):

import express from 'express';
import serveIndex from 'serve-index';
import cors from 'cors';

Note:
running the install, i got the warning @colyseus/[email protected] requires a peer of colyseus@^0.11.0 but none is installed. You must install peer dependencies yourself., So i changed the version in package.json from ^0.12.0 to 0.11.0 and re-installed it, but that didn't help either.

Live demo and the examples are not working

Hi,
I have tried the instructions that I have found on the readme to set up the project but it doesn't seem to work I'm getting connection refused error when I access http://localhost:2657/, also I have tried the heroku live demo I think that it is also not working I'm getting a lot of errors in the browser console.
My node server version is 10.15.1
Thanks

Unable to deploy on Heroku when cloned on local machine

Hi Team,

I tried deploying the colyseus-examples after cloning from git on Heroku via VSCode. But I was not able to get the app running.

here are the build logs.


-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):  >=8.9.1
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version >=8.9.1...
       Downloading and installing node 17.0.1...
       Using default npm version: 8.1.0
       
-----> Installing dependencies
       Installing node modules (package.json)
       
       added 239 packages, and audited 240 packages in 28s
       
       9 packages are looking for funding
         run `npm fund` for details
       
       3 low severity vulnerabilities
       
       To address all issues (including breaking changes), run:
         npm audit fix --force
       
       Run `npm audit` for details.
       
-----> Build
       Running build
       
       > [email protected] build
       > npm run clean && tsc && node node_modules/copyfiles/copyfiles package.json ./lib && node node_modules/copyfiles/copyfiles arena.env ./lib && node node_modules/copyfiles/copyfiles -u 1 src/static/* ./lib
       
       
       > [email protected] clean
       > node node_modules/rimraf/bin lib
       
       
-----> Caching build
       - node_modules
       
-----> Pruning devDependencies
       
       up to date, audited 153 packages in 2s
       
       3 packages are looking for funding
         run `npm fund` for details
       
       3 low severity vulnerabilities
       
       To address all issues (including breaking changes), run:
         npm audit fix --force
       
       Run `npm audit` for details.
       
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 44.6M
-----> Launching...
       Released v3
       https://colyseus-test-freak-v2.herokuapp.com/ deployed to Heroku

console Logs


2021-10-23T10:24:10.118064+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=colyseus-test-freak-v2.herokuapp.com request_id=7124e3e7-8681-4b14-ab34-1b29164926bb fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:24:54.218955+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=colyseus-test-freak-v2.herokuapp.com request_id=78deb601-5793-4f07-b4a0-01627153b69f fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:24:54.762011+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=colyseus-test-freak-v2.herokuapp.com request_id=8e631cba-3d31-411b-972a-c8afd6b98582 fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:24:57.768158+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=colyseus-test-freak-v2.herokuapp.com request_id=7ce4b2ec-4a2c-40f5-83bb-5991d7fef99f fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:24:58.369000+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=colyseus-test-freak-v2.herokuapp.com request_id=d964f86c-b428-4dce-bc28-79f6c8e571a0 fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:25:00.615401+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=colyseus-test-freak-v2.herokuapp.com request_id=f9c1e3e9-921a-4d7b-a14c-dccce5de931a fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:25:01.590205+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=colyseus-test-freak-v2.herokuapp.com request_id=471f6db3-fd09-43b4-9a2c-040e9241d171 fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:28:19.965715+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=colyseus-test-freak-v2.herokuapp.com request_id=67445f44-bff7-4c8c-a088-83234beba696 fwd="15.206.235.52" dyno= connect= service= status=503 bytes= protocol=http
2021-10-23T10:29:57.366075+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=colyseus-test-freak-v2.herokuapp.com request_id=3785ad24-eb3e-4f84-9120-dbc9f9ad6bcf fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https
2021-10-23T10:29:57.877083+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=colyseus-test-freak-v2.herokuapp.com request_id=94496430-1bc2-4a39-b70a-52c26e4d651f fwd="160.202.38.236" dyno= connect= service= status=503 bytes= protocol=https

whereas when I used the deploy on heroku button from the website it was successfully deployed - MyApp

can you please share if I missed anything.

`npm start` on Windows10 throws error, fixed by minor change to package.json

Here is the error:

[email protected] start C:\Users\derricw\Documents\github\colyseus-examples
nodemon --watch '**/*.ts' --exec 'ts-node' index.ts

[nodemon] 1.12.1
[nodemon] to restart at any time, enter rs
[nodemon] watching: '**/*.ts'
[nodemon] starting 'ts-node' index.ts
''ts-node'' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...

And I fixed it by deleting the single quotes around 'ts-node' in line 7 in package.json from:

"start": "nodemon --watch '**/*.ts' --exec 'ts-node' index.ts",
to:
"start": "nodemon --watch '**/*.ts' --exec ts-node index.ts",

Error running javaScript examples

I tried cloning and running as suggested and ran into this error:

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/keithkarnage/Documents/colyseus-examples/node_modules/colyseus/lib/index.js:8:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Continuously unable to deploy my server to heroku

Just a small question for now, please, I just don't get something.

You've defined

"heroku-postbuild": "npm run build"

in your scripts.

And it deploys to Heroku successfully even though a build script is not specified.

When I try to do the same thing (I mean literally the same project with a different name and Room file), Heroku would complain that a build script is missing (which it does - I get it).

How does that happen?

Thank you

Cloned, npm install, then npm start and get an error

Using Node 6 I followed your instructions exactly and get this error:

Error: Cannot find module '/home/andy/dev/colyseus-examples/index.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3

It seems like the index.ts file is never being compiled to index.js -- is that the issue? I dont see any use of webpack or anything so how would this even be done anyways ?

Can't register a room other than "chat"

In the index.ts file, I'm setting these lines from this:

// Register ChatRoom as "chat"
gameServer.register("chat", ChatRoom);

to this:

// Register ChatRoom as "chat"
gameServer.register("something", ChatRoom);

Will always result to this error:

./colyseus/node_modules/colyseus/lib/MatchMaker.js:153
        var room = null, handler = this.handlers[roomName][0], options = this.handlers[roomName][1];
                                                          ^

TypeError: Cannot read property '0' of undefined
    at MatchMaker.create (./colyseus/node_modules/colyseus/lib/MatchMaker.js:153:59)
    at MatchMaker.onJoinRoomRequest (./colyseus/node_modules/colyseus/lib/MatchMaker.js:62:45)
    at process.<anonymous> (./colyseus/node_modules/colyseus/lib/cluster/Worker.js:104:24)
    at emitTwo (events.js:111:20)
    at process.emit (events.js:191:7)
    at process.nextTick (internal/child_process.js:744:12)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
worker 88139 died. Respawn.

It appears the room must be named "chat". Is this the expected behavior, must the room always be called "chat"?

Examples Out Of Date?

These examples do not work with the latest Colyseus server. Will there be an update?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.