Rill is a lightweight C# TCP client and server library with typed messages, background socket work, and main-thread message dispatch through an explicit tick.
- Provides client connect, send, receive, disconnect, and error events.
- Provides a TCP server with connection objects and per-client message delivery.
- Registers message types that implement
IMessageand serialize through LitIO. - Moves socket work off the caller thread and drains deserialized messages during
Tick. - Exposes no-delay, send timeout, receive timeout, and buffer-length settings.
Rill depends on LitIO. Add LitIO first:
https://github.com/onovich/LitIO.git?path=/Assets/com.mortise.litio#main
Then add Rill through Window → Package Manager → Add package from git URL:
https://github.com/onovich/Rill.git?path=/Assets/com.mortise.rill#main
The package metadata declares Unity 2019.4 or later. The included project uses Unity 2022.3.13f1c1.
using MortiseFrame.Rill;
using UnityEngine;
public sealed class ClientSample : MonoBehaviour {
ClientCore client;
void Start() {
client = new ClientCore();
client.OnConnect(() => Debug.Log("Connected"));
client.OnDisconnect(() => Debug.Log("Disconnected"));
client.OnError(message => Debug.LogError(message));
client.Connect("127.0.0.1", 7777);
}
void Update() {
client.Tick(Time.deltaTime);
}
void OnDestroy() {
client?.Stop();
}
}Register every concrete IMessage type before sending or receiving it. The repository sample includes matching client, server, and message implementations.
The server does not currently enforce a maximum incoming message size. Do not expose Rill directly to untrusted public traffic until framing limits, malformed-message handling, and load behavior have been hardened and tested.
The core client/server loop, typed messages, events, and configuration are implemented. Rill has been used in the experimental Ping client and Ping server, but it has not been validated for commercial production.
The current package version is 0.1.5. The repository has no automated integration or security test suite.
Runtime code lives in Assets/com.mortise.rill/Scripts_Runtime/; the compact reference implementation lives in Assets/com.mortise.rill/Resource_Sample/.
