Colyseus.MonoGame 0.17.16

dotnet add package Colyseus.MonoGame --version 0.17.16
                    
NuGet\Install-Package Colyseus.MonoGame -Version 0.17.16
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Colyseus.MonoGame" Version="0.17.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Colyseus.MonoGame" Version="0.17.16" />
                    
Directory.Packages.props
<PackageReference Include="Colyseus.MonoGame" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Colyseus.MonoGame --version 0.17.16
                    
#r "nuget: Colyseus.MonoGame, 0.17.16"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Colyseus.MonoGame@0.17.16
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Colyseus.MonoGame&version=0.17.16
                    
Install as a Cake Addin
#tool nuget:?package=Colyseus.MonoGame&version=0.17.16
                    
Install as a Cake Tool

<div align="center"> <a href="https://colyseus.io/"> <img src="https://github.com/colyseus/colyseus/blob/master/media/logo.svg?raw=true" width="40%" /> </a> <h3>Colyseus Multiplayer SDK for MonoGame</h3> </div>

MonoGame integration for Colyseus — provides a GameComponent that automatically dispatches WebSocket events on the game loop.

Installation

dotnet add package Colyseus.MonoGame

This installs the core Colyseus SDK as a dependency.

Setup

Register the ColyseusGameComponent in your game's Initialize() method:

using Colyseus.MonoGame;

protected override void Initialize()
{
    Components.Add(new ColyseusGameComponent(this));
    base.Initialize();
}

This single line handles all WebSocket event dispatching on the game thread — no manual polling needed.

Quick Example

using Microsoft.Xna.Framework;
using Colyseus;
using Colyseus.Schema;
using Colyseus.MonoGame;

public class Game1 : Game
{
    Client client;
    Room<MyRoomState> room;

    protected override void Initialize()
    {
        Components.Add(new ColyseusGameComponent(this));
        base.Initialize();
    }

    protected override async void LoadContent()
    {
        client = new Client("ws://localhost:2567");

        room = await client.JoinOrCreate<MyRoomState>("my_room");

        var callbacks = Callbacks.Get(room);

        callbacks.OnAdd(state => state.players, (sessionId, player) => {
            System.Diagnostics.Debug.WriteLine($"Player joined: {sessionId}");
        });

        room.Send("move", new { x = 10f, y = 20f });

        room.OnMessage<string>("chat", (message) => {
            System.Diagnostics.Debug.WriteLine("Chat: " + message);
        });
    }

    protected override void OnExiting(object sender, EventArgs args)
    {
        if (room != null) room.Leave();
        base.OnExiting(sender, args);
    }
}

Documentation

See the full documentation at https://docs.colyseus.io/getting-started/monogame

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.17.16 30 3/24/2026
0.17.15 33 3/24/2026
0.17.14 26 3/24/2026
0.17.12 37 3/23/2026
0.17.11 35 3/23/2026