# MessageBus - How to setup Messagebus using Dart-Flutter

**URL:** https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649
**Category:** Development
**Created:** [November 9, 2021, 9:08am UTC](https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649 "2021-11-09T09:08:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Sembauke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sembauke/32/231930_2.png) [@Sembauke](https://meta.discourse.org/u/Sembauke)
#### Post date: [November 9, 2021, 9:08am UTC](https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649/1 "2021-11-09T09:08:55Z")

</div>

Hey Everyone,

I am making a mobile application that uses the Discourse to GET and POST data. At the moment, I am making a request every 30 seconds to see if there are new posts on a topic. This seems like it could potentially harm our forum by accidentally d-dosing ourselfs.

I have been looking for a good solution using WebSockets in Flutter, but no luck yet. For Discourse, I came across MessageBus, which has confounding documentation.

Yet we do have MessageBus setup on our forum as seen in this polling request:  
 ![image](https://global.discourse-cdn.com/meta/original/3X/1/7/17ab28d2deed287fe5911c4f50be59589ee29430.png)

So my question is if anyone has any idea how to solve this problem and has any experience using Message bus or Flutter Websockets.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [November 9, 2021, 10:11am UTC](https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649/2 "2021-11-09T10:11:06Z")

</div>

MessageBus is an option - you can find client libraries for Ruby and JS here: [GitHub - discourse/message\_bus: A reliable and robust messaging bus for Ruby and Rack · GitHub](https://github.com/discourse/message_bus)

But a simpler solution is probably to use Discourse’s WebHooks feature. That way, Discourse can make a web request to your endpoint whenever there is a new topic/post. You can find more information here:

> [@Configure webhooks that trigger on Discourse events to integrate with external services](https://meta.discourse.org/t/setting-up-webhooks/49045):
>
> A webhook is a way to notify external services about changes on the internet. It’s easier to setup, manage and develop than a Discourse plugin. Though, it does require you to program a little bit or understand its technical details. In this #howto, I’ll set up webhook to power a Github bot for referencing pull request brought in a forum. We’ll want to see a new comment on Github pull request when a new post has a link to it. It’s a very simple process: Publish a new post. A webhook event happ…

---

<div class="post-metadata">

### Author: ![bitmage](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bitmage/32/389881_2.png) [@bitmage](https://meta.discourse.org/u/bitmage)
#### Post date: [February 27, 2025, 12:08am UTC](https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649/3 "2025-02-27T00:08:21Z")

</div>

I don’t see how webhooks would be related or useful at all to a Flutter frontend.

It seems like what OP is looking for is a Dart implementation of the MessageBus client… which would probably have to be reverse engineered from [this Javascript code](https://github.com/discourse/message_bus/blob/ab67220a797388e12c980b14ced0cc87fc5a8bc9/assets/message-bus.js). Another alternative might be to run the Javascript code within Dart, and then wrap it in bindings to translate from Javascript to Dart. A direct port to Dart should be the more performant of these two.

Someone please correct me if I’m wrong. This isn’t something I’ve dug into, but I think the idea of a Flutter frontend is intriguing.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [February 27, 2025, 12:04pm UTC](https://meta.discourse.org/t/messagebus-how-to-setup-messagebus-using-dart-flutter/208649/4 "2025-02-27T12:04:49Z")

</div>

> [@bitmage](#):
>
> I don’t see how webhooks would be related or useful at all to a Flutter frontend.

The idea would be Webhooks → your backend → your app. So, the app wouldn’t be receiving the webhooks directly.
