servicepoint/examples/websocket.rs
Vinzenz Schroeter 1cf37413e6
All checks were successful
Rust / build (pull_request) Successful in 2m15s
implement From<X> for XCommand
2025-03-25 22:20:44 +01:00

18 lines
485 B
Rust

//! Example for how to use the WebSocket connection
use servicepoint::{
Bitmap, BitmapCommand, ClearCommand, Connection, Grid, WebsocketConnection,
};
fn main() {
let uri = "ws://localhost:8080".parse().unwrap();
let connection = WebsocketConnection::open(uri).unwrap();
connection.send(ClearCommand).unwrap();
let mut pixels = Bitmap::max_sized();
pixels.fill(true);
let command = BitmapCommand::from(pixels);
connection.send(command).unwrap();
}