colyseus / colyseus.js

⚔ Colyseus Multiplayer SDK for JavaScript/TypeScript
https://docs.colyseus.io/getting-started/javascript-client/
MIT License
410 stars 107 forks source link

Support non-browser client #46

Closed pjc0247 closed 5 years ago

pjc0247 commented 5 years ago

I know it's not common write a game client with NodeJS. but some people wants to make a straightforward client with Javascript for testing purpose.

Current version cannot be executed on NodeJS with following error:

ws does not work in the browser. Browser clients must use the native WebSocket object
endel commented 5 years ago

Hi @pjc0247, we recently added support for Node.js: https://github.com/colyseus/colyseus.js/issues/25

How your environment looks like? I've just tested adding colyseus.js and ws as dependencies on package.json, and it works fine. The loadtest tool also uses the JavaScript client (https://github.com/colyseus/colyseus-loadtest)

Cheers!

pjc0247 commented 5 years ago

@endel I didn't notice that there's already support for NodeJS env.

Thanks!