Messenger is a simple wrapper for Roblox’s MessagingService.
It allows developers to subscribe to an unlimited number of topics (there is a limit with MessagingService). You can also bypass the character limit for topics (which is 80) using Messenger as it has no character limit
I plan to add more features to it in the future.
Example Usage
Below is an example on how to use Messenger, it makes use of all the functions of the current functions of Messenger
local Messenger = require(PATH_TO_MESSENGER)
local Topic = Messenger.new("Example Topic")
Topic:SubscribeAsync(function(message) print(message) end)
Topic:PublishAsync("This message was sent from "..game.JobId,"!")
local MessagingService = game:GetService("MessagingService")
MessagingService:SubscribeAsync("Example Topic", function(Message) print(Message) end)
MessagingService:PublishAsync("Example Topic", "This message was sent from "..game.JobId.."!")
You’re able to add an unlimited number of subscriptions (MessagingService limits this to 8 per server I believe) and it also is a tiny bit easier if you have a lot of code doing PublishAsync
Using Messenger the code would be like this:
local Messenger = require(PATH_TO_MESSENGER)
local Topic = Messenger.new("Example Topic") --// only do topic once so you don't need to type it in every time (ex: MessagingService:PublishAsync("Topic") would be typed in tons)
--// publish message on load?
Topic:PublishAsync("Script was loaded!"..game.JobId,"!")
--// do something on event
something.onFakeEvent:Connect(function(something)
Topic:PublishAsync("something happened?!?!")
end)
--// do something on different event
somethingElse.whenSomethingElseHappens:Connect(function(something)
Topic:PublishAsync("wow")
end)
Using MessagingService would make the code like this:
--// publish message on load?
MessagingService:PublishAsync("Example Topic", "Script was loaded!"..game.JobId.."!")
--// do something on event
something.onFakeEvent:Connect(function(something)
MessagingService:PublishAsync("Example Topic","something happened?!?!")
end)
--// do something on different event
somethingElse.whenSomethingElseHappens:Connect(function(something)
Topic:PublishAsync("Example Topic","wow")
end)
So it saves you a tiny bit of time from needing to repeat “Example Topic” (which would be more annoying on large scripts I’d assume)
Anyways, there will be more features to come in the future which will improve the module.
Oh sorry please ignore that I have used messaging service lots of time I just saw your example and thought that was the module I genuinely didn’t read I’m ever so sorry.
It’s basically a script which goes on top of something (for example, an API) and makes it easier to use or adds additional functionality.
For example, I could make a wrapper for the Roblox API which would make it easier for me to send HTTP requests to the API by just making a single function to do that.
So instead of long repetitive code like
local res = game:GetService("HttpService"):GetAsync("random url")
-- do stuff with res