RxMQTTnet
A extension to the MQTTnet project, to transform the subscriptions into observables and to publish form a observalbe stream.
Install / Use
/learn @mmuecke/RxMQTTnetREADME
RxMQTTnet
An extension to the MQTTnet project, to transform the subscriptions into observables and to publish from an observable stream.
Create a client
Use the factory
Use the MQTTnet.MqttFactory with the MQTTnet.Extensions.External.RxMQTT.Client.MqttFactoryExtensions.
var client = new MqttFactory().CreateRxMqttClient();
Create the options
Use the managed client options
Start the client
await client.StartAsync(options).ConfigureAwait(false);
Subscribe
Get an IObservable<MqttApplicationMessageReceivedEventArgs> by connecting to the rx client and use extensions to process the message:
var subscription = rxMqttClinet
.Connect("RxClientTest/#")
.SelectPayload()
.Subscribe(Console.WriteLine);
End the subscription by disposing the subscription.
subscription.Dispose();
Publish
From observable
Create an observable sequence of MqttApplicationMessages and publish these via the rx client.
Observable.Interval(TimeSpan.FromMilliseconds(1000))
.Select(i => new MqttApplicationMessageBuilder()
.WithTopic("RxClientTest")
.WithPayload("Time: " + DateTime.Now.ToLongTimeString())
.WithQualityOfServiceLevel(MqttQualityOfServiceLevel.ExactlyOnce)
.WithRetainFlag()
.Build())
.PublishOn(mqttClient)
.Subscribe();
Single message
Use the mqtt client publish method.
Related Skills
node-connect
354.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
