Skip to content

cansik/mqtt-protobuf-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT with ProtoBuf Example

A simple MQTT and Protobuf example in C#.

The idea was to prototype a solution where you are able to connect to a topic with a specific message type:

client.Subscribe<string>("hello/world", (sender, topic, message) =>
{
    Console.WriteLine($"New Message: {message}");
});

client.Subscribe<Status>("game/status", (sender, topic, message) =>
{
    Console.WriteLine($"New position: {message.Position.X}, {message.Position.Y}");
});

And of course publish new messages (strings and proto atm):

client.Publish("hello/world", "hello world");

var status = new Status
{
    Enabled = true,
    Position = new Vector3()
    {
        X = 0.5f, Y =  1.5f, Z = 2.4f
    }
};
client.Publish("hello/status", status);

About

A simple MQTT and Protobuf example in C#.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published