Hello fellows! I’m kianu, growing programmer. I’ve heard messaging service but I’m still confused what is it and what does messaging service used for? And how it works.
Thank you!
Hello fellows! I’m kianu, growing programmer. I’ve heard messaging service but I’m still confused what is it and what does messaging service used for? And how it works.
Thank you!
MessagingService
is a API used to Communicate Between Servers
A service is an API? Isnt mesagging service is a service?
According to this Post, No
Also this:
I think API (Application Programming Interface) is a fancy term that means what the function or property is actually called. For example, you know a part has to have some sort of positional and rotational value to it. The API for that would be the CFrame.
This is important because you have to be exact in the spelling of the function or variable you’re trying to use.
So the API is the properties, functions, and events of the service so you can use the service.
messaging service can receive and send data chunks to all your game’s active servers.
So API on roblox is different with the other API?
Is This messaging service same with the roblox messaging service?
I’m Pretty sure most (if not all) Services have (or are) an API, Like with DataStores, that has an API.
Not Exactly, MessagingService
on ROBLOX is for Servers to Communicate, not anything related to Other types of Communications.
For servers to communicate to what?
For Servers to Communicate with each other.
For Example, If you want a Global Event, you would use MessagingService
to Fire for Every Server that is Subscribed
What is a global event? Sorry if I’m to much askin I’m a beginner
On the side note of this, this thing kind of resembles publish-subscribe pattern, for anyone interested deeply in it:
So in Roblox’s setup, you have a “server” and then several “clients” connected to the one server. And then this is repeated depending on how many players you have on a game. Lets say I have 10 servers with 10 players each on them. That means I have 100 players in the game.
Now lets say I want to end an event at the same time. I can use MessageService to tell all the other servers to end the event, which would cause all 10 servers and 100 players to stop the event at the same time. That would be a “global event”
What do you mean by event? Arent event thing in the code?
Yes there are “events” in code. Namely, there are RemoteEvent, BindableEvent, and then there are properties of objects that are events. The concept is fairly simple. One piece of code fires an event, which results in all connected functions to be called.
For example,
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
print("Player "..Player.Name.." has joined") -- this will print when a player joins the game
end)
function pAdded(plr)
print(plr.UserId)
end
Players.PlayedAdded:Connect(pAdded)
Here I have 2 functions connected to the PlayerAdded event, which is a property of game.Players; It will fire whenever a player connects to the server. The way I connected the functions is fairly common.
RemoteEvent is used in server-to-client or client-to-server communication.
BindableEvent is used in device-sided only communication. (I say device-side only because there is 1 server with several clients and each client is a device and the server itself is a single device.)
Let me clarify that when I say
I mean an “event” as in a game’s event like a egg hunt or winter event or april fools event. Like not programming event.
If my game had an april fools event and I wanted to stop the event right now I could use MessagingService to tell all the servers to take down the event so they wouldn’t allow players to access that anymore. I meant event as in the english term event.
However in Roblox you have a programming mechanic which is called event (the programming event is technically called RBXScriptSignal). Here’s some examples of events used in Roblox:
Humanoid.Running
Players.PlayerAdded
RunService.RenderStepped
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.