요약
메서드
PublishAsync(topic: string,message: Variant):() |
SubscribeAsync(topic: string,callback: function):RBXScriptConnection |
상속된 멤버
API 참조
메서드
PublishAsync
SubscribeAsync
코드 샘플
크로스 서버 메시지 구독
local MessagingService = game:GetService("MessagingService")
local Players = game:GetService("Players")
local function onPlayerAdded(player)
-- 주제에 구독하기
local topic = "player-" .. player.UserId
local connection = MessagingService:SubscribeAsync(topic, function(message)
print("Received message for", player.Name, message.Data)
end)
player.AncestryChanged:Connect(function()
-- 주제에서 구독 취소하기
connection:Disconnect()
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)