MessagingService Handler

With the release of the new MessagingService, some people may not know how to work it exactly. I came up with the idea of making it into a simple OOP last night and wanted to make it real.

Documentation is pretty simplistic.

local Handler = require(script.ModuleScript)
local Service = Handler.Attach('Test') --Attaches and listens to given topic
Service.OnData:Connect(function(Content,Timestamp) --When the attached topic is being published to
	print('[HANDLER DATA]')
	print(Content,' | ',Timestamp)
Service.Publish('hello there')
--after disconnect, if you try to publish to it again it will error
Service.Publish('hello there!!')

Hope this helps people that need it!


This topic was automatically closed after 8 minutes. New replies are no longer allowed.

A post was merged into an existing topic: What are you working on currently? (2019)