Skip to content

[Feature] Decouple connection layer to allow custom WebSocket implementations #266

@VinceYGG

Description

@VinceYGG

Problem
Currently, the Colyseus Unity SDK handles the websocket data using its own tightly coupled connection layer. In larger projects, we often already have a standardized WebSocket implementation used across the entire application. Because the SDK's transport layer cannot be easily overridden, we are forced to maintain multiple distinct networking implementations within the same project. This lack of consistency across the transportation layer causes confusion, makes debugging harder, and adds unnecessary overhead.

Solution
I would like the connection/transport layer to be decoupled into a customizable module or interface (e.g., IWebSocketTransport or IConnection).

The SDK should still provide the current implementation as the default out-of-the-box solution, but it should expose a way for developers to inject a custom transport layer when initializing the Colyseus Client.

For example:

var myCustomTransport = new MyProjectWebSocketImplementation();
var client = new Colyseus.Client("ws://localhost:2567", myCustomTransport);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions