This page walks through three installation paths and a 5-minute "from zero to running echo" tour.
- .NET SDK 7.0 / 8.0 / 9.0 / 10.0 (recommend 8.0+)
- Node.js 18+ (if you need the TypeScript/JavaScript client)
- Optional: Unity 2021+ (
GoPlay.Clienttargetsnetstandard2.1for this)
dotnet new install GoPlay.Templates
dotnet new goplay-tcp -n MyGame # TCP fast path (NetCoreServer)
# or
dotnet new goplay-ws -n MyGame # WebSocket (browser / mini-game)
cd MyGame
dotnet build
dotnet run --project Main -- start -h 127.0.0.1 -p 8888See the template layout in 09.structure.md.
# Server side
dotnet add package GoPlay.Server
dotnet add package GoPlay.Core.Transport.NetCoreServer # or Transport.Ws / Transport.Wss
# Client side
dotnet add package GoPlay.Client
# CLI (optional, used to generate client extensions)
dotnet tool install -g GoPlay.Toolsgit clone https://github.com/Jennal/GoPlay.Net.git
cd GoPlay.Net
dotnet run --project Frameworks/Demo/Demo.TcpServer # or Demo.WsServerUnder Demo.Common you will find TestProcessor.cs, ChatProcessor.cs and AirPlaneProcessor.cs - three fully working processor samples that exercise Request / Notify / Push / Broadcast / Update.
Using the goplay-tcp template.
dotnet new install GoPlay.Templates
dotnet new goplay-tcp -n MyGame
cd MyGameOpen Processors.Logic/EchoProcessor.cs; the template already generates:
[Processor("echo")]
public class EchoProcessor : ProcessorBase
{
public override string[] Pushes => new[] { "echo.push" };
[Request("request")]
public PbString Request(Header header, PbString data)
{
return new PbString { Value = $"Serv reply: {data.Value}" };
}
[Notify("notify")]
public void Notify(Header header, PbString data)
{
Push("echo.push", header, new PbString { Value = $"Serv push: {data.Value}" });
}
}[Processor("echo")]mounts the class under theechoroute namespace.[Request("request")]registers the method as routeecho.request. The first parameter must beHeader; the second is your Protobuf message.Pushesdeclares which routes this processor can push to the client.
The template ships scripts/gen_ext.sh that calls the goplay CLI to scan every processor and write Client.Extension/ClientExtensions.fe.cs:
cd scripts
bash gen_ext.shGenerated extensions let the client call server processors like local functions:
public static Task<(Status, PbString)> Echo_Request(this Client client, PbString data)
=> client.Request<PbString, PbString>("echo.request", data);The template includes UnitTests/TestEcho.cs (TestEcho.cs):
[Test]
public async Task TestRequest()
{
var (status, resp) = await _client.Echo_Request(new PbString { Value = "Hello" });
Assert.AreEqual(StatusCode.Success, status.Code);
Assert.AreEqual("Serv reply: Hello", resp.Value);
}Run it:
dotnet test UnitTests/UnitTests.csprojdotnet run --project Main -- start -h 127.0.0.1 -p 8888With the server up, point any client (the templated C# client, Unity, or TypeScript npm install goplay-ws) at it - see 07.clients.md.
- Terminology and mental model: 03.concepts.md
- Official performance baseline & tuning tips: 02.performance.md
- Actor model deep-dive: 04.processor-model.md
- Swap Transport / Encoder: 05.transport-encoder.md
- Automate codegen: 06.tools-codegen.md
- Browser / mini-game clients: 07.clients.md
- Filter / Session / graceful shutdown: 08.advanced.md