JavaScript JavaScript SDK

The JavaScript/TypeScript SDK is engine agnostic and can be used with any game engine or framework that supports WebSockets, such as:

  • Modern web browsers (and mobile web browsers)
  • Node.js
  • Bun
  • Electron
  • React Native
  • Engines/Frameworks: Phaser, PlayCanvas, React, Pixi.js, Babylon.js, THREE.js, KAPLAY, etc.

Adding the JavaScript SDK to your project

This is the preffered method if you’re using a build tool (vite, webpack, rollup, or similar)

npm install --save colyseus.js

If you’re not using a build tool, it is recommended to download the release binaries from GitHub Releases

<script src="colyseus.js"></script>

Alternatively, you may include the distribution file directly by using unpkg. Make sure to replace the @x.x.x portion of it with a version compatible with your server.

<script src="https://unpkg.com/colyseus.js@^0.16.0/dist/colyseus.js"></script>
Last updated on