question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integration API for the broker

See original GitHub issue

It is clearly a common use-case to embed the broker in a larger application (Issue #41, #33, #21, #38) that has some functionality, and attempt to talk back to the clients. People keep re-writing the same thing again and again.

Instead of trying to use client and server library withing one application, or using loopback (which is impossible in UWP) we can design an API into the broker that would enable it to create a “virtual” client and talk to other clients on the network.

It would be trivial to implement an event-based API to notify the parent application of new messages, and with a bit of through we can put together an API to “talk back” to the clients.

Integration API

  • Presense - See how many clients are connected
  • Management Events - Client Joined / Client left events
  • Observe - see messages that are being exchanged
  • Publish - let the broker send messages. Mosquitto does that on the topic $SYS/, but that’s just a convention
  • Subscription Permissions - Not all clients can be trusted entirely. We must have a way to reject a client subscribing to messages they are not entitled to. Here is how Mosquitto implements an Access Control File. In this case we must return 0x80.
  • Publish Permissions - Again, not all clients should be allowed to publish anywhere they feel like. However MQTT protocol is not great at dealing with this. As per official spec

If a Server implementation does not authorize a PUBLISH to be performed by a Client; it has no way of informing that Client. It MUST either make a positive acknowledgement, according to the normal QoS rules,or closethe Network Connection [MQTT-3.3.5-2]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dtflx01commented, Nov 28, 2017

@VladimirAkopyan I already added ‘ClientJoined / Client Left’ event. feature, see commit 2afb198 . You can merge it, I’m using it into my application. Regards

1reaction
dkkristecommented, Sep 28, 2017

Sending a message should be as simple as calling Publish(MqttMsgPublish publish) in the MqttPublisher manager (you of course would need a reference to that). Observe messages which are exchanged/received could probably be done by subscribing to an event which for instance gets called inside the PublishThread loop (say around line 282 where the incoming messages are dequeued). And querying/exposing the MqttClientCollection clients in MqttBroker.cs should give you a indication on the number of active connections.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Integration. What is it, and how can it take your ...
APIs present immeasurable business opportunities by helping deliver seamlessly integrated user experiences from one device to the next and enabling real-time ...
Read more >
Best Brokers with API Access: API Trading Platforms ...
Best API Brokers Compared · #1 Alpaca · #2 Interactive Brokers · #3 TD Ameritrade · #4 Tradier.
Read more >
Using the Integrations API to share Broker tokens between ...
Step 1: Create an integration with a shared Broker token · Clone the new integration to the other organizations that you want to...
Read more >
Brokers With APIs 2023 - What Are They & How To Get ...
Brokers with APIs allow users to trade via an application programming interface, which lets you receive information from the broker's server, like historical ......
Read more >
Automated Trading Broker API
TradersPost API simplifies integration with popular brokers and adds trading functionality to your app. It's a unified, standardized automated trading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found