#webrtc #udp #server #networking #gamedev


A server that uses either UDP or WebRTC communication to send/receive events to/from connected clients, and syncs registered actors to clients to whom those actors are in-scope

11 releases (4 breaking)

0.5.0 May 2, 2021
0.4.2 Apr 3, 2021
0.4.1 Nov 29, 2020
0.3.0 Oct 11, 2020
0.1.3 Jul 7, 2020

#658 in Network programming

Download history 11/week @ 2021-06-05 4/week @ 2021-06-12 2/week @ 2021-06-19 5/week @ 2021-06-26 1/week @ 2021-07-03 14/week @ 2021-07-17 12/week @ 2021-07-24 24/week @ 2021-07-31 5/week @ 2021-08-07 22/week @ 2021-08-14 5/week @ 2021-08-21 2/week @ 2021-08-28 1/week @ 2021-09-04 3/week @ 2021-09-11 4/week @ 2021-09-18

107 downloads per month


3.5K SLoC

Build Status Latest Version API Documentation Discord chat MIT/Apache


a networking architecture for interactive applications

A cross-platform (including Wasm!) networking engine that intends to make multiplayer game development in Rust dead simple and lightning fast.

Check out the quicksilver & macroquad demos.

At the highest level, you register Event and Actor implementations in a module shared by Client & Server. Then, naia will facilitate sending/receiving those Events between Client & Server, and also keep a pool of tracked Actors synced with each Client for whom they are "in-scope". Actors are "scoped" to Clients with whom they share the same Room, as well as being sufficiently customizable to, for example, only keep Actors persisted & synced while within a Client's viewport or according to some other criteria.

It is built on top of naia-socket, which provides cross-platform unreliable & unordered messaging.

The API is heavily inspired by the Nengi.js & Colyseus Javascript multiplayer networking libraries. The internals follow the Tribes 2 Networking model fairly closely.

Thank very much to Kyren for support & webrtc-unreliable, and to the Laminar authors, for the cannibalized code within.

Any help is very welcome, please get in touch! I'm still very new to Rust and this project is overly ambitious, and so I intend to be very open to any criticism / feedback in order to better this project.

Currently guaranteed to work WebAssembly & Linux, although Windows & MacOS have been reported working as well. Please file issues if you find inconsistencies and I'll do what I can.


More comprehensive documentation / tutorials are on their way, but for now, the best way to get started with naia is to go through the single example, which demonstrates most of the functionality.


To run the UDP server example on Linux: (that will be able to communicate with Linux clients)

1. cd demo/server
2. cargo run --features "use-udp"

To run the WebRTC server example on Linux: (that will be able to communicate with Web clients)

1. cd demo/server
2. cargo run --features "use-webrtc"


To run the UDP client example on Linux: (that will be able to communicate with a UDP server)

1. cd demo/client/miniquad
2. cargo run

To run the WebRTC client example on Web: (that will be able to communicate with a WebRTC server)

1. cargo install cargo-web  // should only need to do this once if you haven't already
2. Enter in your IP Address at the appropriate spot in examples/client/src/app.rs
3. cd demo/client/wasm_bindgen // consult NOTES.md
4. npm install              // should only need to do this once to install dependencies
5. npm run start            // this will open a web browser, and hot reload
6. Web page will be blank - check debug console to see communications from the server.


~258K SLoC