C
C#•7d ago
malkav

Trying to figure a means of Message Brokering

A little bit of context ahead of time: I have an application that runs various services, as well as a little bit of "Game logic" that needs to run as a sort of centralized server on a terrain with a Mesh Wifi network that has various Arduino and Rasberry Pi interfaces connected to. (to the same wifi network) The application I'm building, has a couple of features in its services: - Nexus => This is an API connection to the API "The Nexus" which hosts player data about participants in a live-action game. From here I am fetching data, and since there's no other endpoint than a "GET" I store that data in my own database, and go on from there. - Alexandria => This is my Database Connection, it should connect to an SQL database with my tables and all in there. I am going to try and use Dapper to make my life easier. - Ravens => This is my custom logger which logs to only my files, and to a semi-console I built with a minimal WinForms (don't ask, it works lol) - Void => This is where I get stuck. This should be a broker of some kind. (Explanation below) - Gaming => Here is where some of the game logic happens, and I say game-logic with the most broad idea of the term. It should handle simply "is this player allowed to do x or y? then show lights and sound" sort of thing. But there's some extra logic, and it manifests "in-game" so I call it game logic... Now where I get stuck is "Void" It should be a message broker, that can work somewhat like a webhook.. kind of? There should be a "NotifyListeners" and a "Subscribe to channel" like action, and it should be able to work both ways. My application should be the Host for this network, and so I need it to be server and client (Subscribed to its own channels for listening for responses, as well as being able to send messages over the subscription) and the arduino's (etc) can subscribe to the channel, but also send messages over the channel. I've heard of MQTT, or SignalR but I am lost as to what and how... can someone help?
3 Replies
Patrick
Patrick•7d ago
You should likely read up about KISS first. I get lost trying to read and understand all the different mechanisms in your setup because of these names you've given them. In a more serious answer: You need a centralised message bus/queue, that will capture messages and process them. This is likely where your Arduino is also plugged into? Unless that's on another machine. This could be as simple as a database you write to at the end of an API or RabbitMQ etc. Each consumer of the queue then writes/reads messages.
malkav
malkavOP•7d ago
Sorry, the KISS principle is still here, but for the team 😅 mostly the names are in line with the game itself, but for the rest it's Ravens => Logger Nexus => APi is called Nexus... so API would work? Alexandria => Library of Alexandria, aka Database Void... yeh this one should change... Also, a database table to query from is not feasable, since the Arduino's are connecting ober a wifi network that has to connect to somewhere outside, the latency would be too long. Something like SignalR or MQTT would be more in the direction I'm thinking of, but it's confusing so I might need some reference material to build something...
Sossenbinder
Sossenbinder•7d ago
For arduino, I'd definitely look into mqtt, it's a protocol which is a bit cut down in scope but in terms of power consumption and resource efficiency it's a good match for an arduino Amqp based brokers might be a bit too much to handle for an arduino

Did you find this page helpful?