public static void Main(string[] args) { var bus = new MQTTBus(); var client = new SimnetClient(bus, "FirstClient"); client.Connect(IPAddress.Loopback, 1883); Thread.Sleep(1000); client.Subscribe <string>("hello/world", (sender, topic, message) => { Console.WriteLine($"New Message: {message}"); }); client.Subscribe <Status>("hello/status", (sender, topic, message) => { Console.WriteLine($"New position: {message.Position.X}, {message.Position.Y}"); }); Console.WriteLine("listening for messages!"); Console.ReadKey(true); }
public static void Main(string[] args) { var bus = new MQTTBus(); var client = new SimnetClient(bus, "SecondClient"); client.Connect(IPAddress.Loopback, 1883); Thread.Sleep(1000); var status = new Status { Enabled = true, Position = new Vector3() { X = 0.5f, Y = 1.5f, Z = 2.4f } }; //client.Publish("hello/world", "hello world"); client.Publish("hello/status", status); Console.WriteLine("all done!"); }