use ndisplay_cluster_events::{JsonEvent, WriteJsonEvent}; use std::net::TcpStream; fn main() { // Open a connection to nDisplay on the local host. let address = format!("localhost:{}", JsonEvent::DEFAULT_PORT); let mut stream = TcpStream::connect(address).unwrap(); // Create a `JsonEvent` with some data. let json_event = JsonEvent { name: "MyJsonEvent".into(), ..Default::default() }; // Send the event. stream.write_json_event(&json_event).unwrap(); }