#webrtc #udp #server #gamedev #networking

naia-server-socket

An abstraction to provide a common API over either a UDP socket or a service that can establish WebRTC connections

10 releases

0.3.2 Oct 11, 2020
0.3.1 Aug 17, 2020
0.3.0 Jul 13, 2020
0.2.4 Jul 11, 2020
0.1.1 Jun 29, 2020

#728 in Network programming

Download history 5/week @ 2020-07-29 15/week @ 2020-08-05 42/week @ 2020-08-12 19/week @ 2020-08-19 26/week @ 2020-08-26 47/week @ 2020-09-02 17/week @ 2020-09-09 4/week @ 2020-09-16 7/week @ 2020-09-23 14/week @ 2020-09-30 24/week @ 2020-10-07 8/week @ 2020-10-14 16/week @ 2020-10-21 11/week @ 2020-10-28 19/week @ 2020-11-04 14/week @ 2020-11-11

88 downloads per month
Used in naia-server

MIT/Apache

41KB
832 lines

Build Status Latest Version API Documentation Discord chat MIT/Apache

naia-socket

A cross-platform (currently WebAssembly & Linux) Socket API that wraps unreliable & unordered communication, using WebRTC & UDP.

Utilizes Kyren's wonderful webrtc-unreliable

Examples

Server:

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

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

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

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

Client:

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

1. cd examples/client
2. cargo run

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

1. Enter in your IP Address at the appropriate spot in examples/client/src/app.rs
2. cd examples/client
3. npm install              //should only need to do this once to install dependencies
4. npm run start            //this will open a web browser, and hot reload

To simply build these examples instead of running them, substitute the above commands like so:

`cargo build` for `cargo run`, and

`npm run build` for `npm run start`

Dependencies

~3–4.5MB
~86K SLoC