In regular local Roblox studio testing MessagingService:SubscribeAsync() doesn’t function like in live servers, but using it doesn’t halt the running coroutine. However in Team Testing it seems like calling MessagingService:SubscribeAsync() will halt the running coroutine completely without any warning or thrown error.
This was found in this block of code:
print("Subscribe start") -- Runs!
local last_roblox_message = 0
profile.roblox_message_subscription = MessagingService:SubscribeAsync("PS_" .. unique_session_id, function(message)
if type(message.Data) == "table" and message.Data.LoadCount == profile.SessionLoadCount then
-- High reaction rate, based on numPlayers × 10 DataStore budget as of writing
if os.clock() - last_roblox_message > 6 then
last_roblox_message = os.clock()
if profile:IsActive() == true then
if message.Data.EndSession == true then
SaveProfileAsync(profile, true, false, "External")
else
profile:Save()
end
end
end
end
end)
print("Subscribe end") -- Never runs in Team Test
I would expect MessagingService:SubscribeAsync() to have consistent behaviour in local studio testing and team testing where it would not halt.
Thanks for the report. Yeah the MessagingService is not supported in Team Test because such test messages shouldn’t be messing up with the regular messages in production. Meanwhile, Team Test runs in a game server so it’s also different from the local test in Studio which isolates the messages in its own space. That being said, we’re evaluating how to allow messaging in Team Test.
Allowing MessagingService to be used in Studio, even if the messages are only sent to Studio sessions, would be so helpful for certain games. Some games rely on this service and are unable to test their games in Studio, having to resort to publishing the update and testing it in live servers instead.
To clarify for everyone following this thread, MessagingService does work if you click the Play button to test in Studio. Please let us know if it doesn’t work for you.
The issue being discussed here is that it doesn’t work in Team Test. As I explained in a comment above, the concern with Team Test is that it runs on a game server so the messages will go to the same message channel which can mess up the production environment. I agree we should at least log an error saying it’s not supported for TeamTest in this case.
Update: we’re fixing this by sending the messages to the Test channel so Team Test will share the same data with Studio since they are both for testing purpose for MessagingService.
I’m still seeing no messages received in Team Test when using Open Cloud MessagingService APIs . I don’t use the engine-side MessagingService:PublishAsync(), only Open Cloud. Does this recent fix apply to messages sent through Open Cloud, or is it currently limited to in-engine calls only?
Open Cloud API is for only production environment, so you can receive those messages only from an actual game server. Team Test is treated as Studio test for the MessagingService, the messages it can publish or receive are isolated into a test environment.
To test MessagingService in TeamTest and Studio test, you have to use the MessagingService API calls in engine.