https://github.com/first-rust-competition/nt-rs
Rust implementation of NetworkTables (v3)
https://github.com/first-rust-competition/nt-rs
frc networktables rust
Last synced: about 1 month ago
JSON representation
Rust implementation of NetworkTables (v3)
- Host: GitHub
- URL: https://github.com/first-rust-competition/nt-rs
- Owner: first-rust-competition
- License: mit
- Created: 2019-11-13T04:27:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T20:56:14.000Z (about 4 years ago)
- Last Synced: 2025-03-26T01:51:11.433Z (2 months ago)
- Topics: frc, networktables, rust
- Language: Rust
- Homepage:
- Size: 252 KB
- Stars: 8
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nt-rs
nt-rs is an implementation of the NetworkTables revision 3 protocol in Rust using Tokio.
Currently it is purely a client library. An API for creation of an NT server may come in the future.# Getting Started
This library can be found on https://crates.io and can be added to a project with `nt = "0.1.0"`
Sample usages can be found in the `examples/` directory# What is NetworkTables?
NetworkTables, or NT, is a TCP based protocol for key-value data storage. It is most used within code for _FIRST_ Robotics Competition robots, for sharing data across the robot's network.# Examples
### Connecting to a server
```rust
let mut nt = NetworkTables::connect("10.TE.AM.2:1735", "nt-rs-client")?;
```
### Creating a server
```rust
let mut nt = NetworkTables::bind("0.0.0.0:1735", "nt-rs-server");
```## Websockets
`nt` 1.0.0 adds support for clients and servers communicating over websockets. This is locked behind the `websocket` feature.
### Connecting to a websocket server
```rust
let mut nt = NetworkTables::connect_ws("ws://10.TE.AM.2:1735", "nt-ws-client")?;
```### Creating a websocket server
An existing NetworkTables server is capable of serving websockets if the program is compiled with the websocket feature. In cases where a websocket attempts to connect to a server that has not been configured for websocket clients, it will be sent an error message and the connection will be disconnected.# License
This project is licensed under the MIT license.# Acknowledgements
Thanks to Jess Creighton (https://github.com/jcreigh) for giving me the idea