8000 GitHub - RagingKore/RxMQTTnet: A extension to the MQTTnet project, to transform the subscriptions into observables and to publish form a observalbe stream.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A extension to the MQTTnet project, to transform the subscriptions into observables and to publish form a observalbe stream.

License

Notifications You must be signed in to change notification settings

RagingKore/RxMQTTnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build codecov NuGet Stats Downloads

RxMQTTnet

A extension to the MQTTnet project, to transform the subscriptions into observables and to publish form a observalbe stream.

Crate a client

Use the factory

Use the MQTTnet.MqttFactory wiht the MQTTnet.Extensions.External.RxMQTT.Client.MqttFactoryExtensions

var client = new MqttFactory().CreateRxMqttClient();

Crate the options

Use the managed clinent options

Start the clinet

awiat client.StartAsync(options).ConfigureAwait(false);

Subscribe

Get a IObservable<MqttApplicationMessageReceivedEventArgs> by connecting to the rx client and use extensions to process the message:

var subscription = rxMqttClinet
    .Connect("RxClientTest/#")
    .GetPayload()
    .Subscribe(Console.WriteLine);

To end the subscribtion dispose the subscribtion.

subscription.Dispose();

Publisch

From observable

Create a observalbe sequenc of MqttApplicationMessages and publish them via the rx client.

Observable.Interval(TimeSpan.FromMilliseconds(1000))
    .Select(i => new MqttApplicationMessageBuilder()
        .WithTopic("RxClientTest")
        .WithPayload("Time: " + DateTime.Now.ToLongTimeString())
        .WithExactlyOnceQoS()
        .WithRetainFlag()
        .Build())
    .PublishOn(mqttClient)
    .Subscribe();

Single message

Use the mqtt client publish method.

About

A extension to the MQTTnet project, to transform the subscriptions into observables and to publish form a observalbe stream.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%
2AE0
0