emaalouly1 avatar image
emaalouly1 asked

SharedGroupData Notification on Desktop


I have made a notification system (friend request, invite to game...) on a desktop game using unity as follows:

- Client sends a friend request using a cloud script function

- The function then fills in the SharedGroupData of the friend with the name of the player who sent it

The player receives the notification, but the way I am refreshing the notification list is by using the "Heartbeat" method, which is to request the data from the SharedGroupData every like 5 seconds or so.

But isn't this too costly to keep requesting data every few seconds? because I have other methods that does the same like the friends list that keeps refreshing in the same way.

This is working perfectly, and I know there is no push notifications for desktops, but is there a better solution than this?

Thank you

CloudScriptShared Group DataFriends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

brendan avatar image
brendan answered

Yes, we'll be adding a publish/subscribe system in an upcoming release, at which point you'll want to move to that. For now, if you use a heartbeat model for this sort of thing, please don't query more often than about every 30 seconds (which is similar to the heartbeat period in PSN and XBL).

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

emaalouly1 avatar image emaalouly1 commented ·

Alright I will stick to the 30 seconds heartbeat for now, but that means if someone invites his friend it will take up to 30 seconds before he receives the invite..

Can you please explain more of what the publish/subscribe system is? and how long is approximately the upcoming release for it? a month, a year?

0 Likes 0 ·
brendan avatar image brendan emaalouly1 commented ·

Honestly, I can't see that being an issue for your players. The heartbeat time on Xbox Live is such that it can be up to 40 seconds before you get a presence update for friends, and I've never heard of that being an issue.

The pub/sub model is that an entity (client/server) will be able to subscribe to specific events from another entity. So you'll be able to specify PlayStream events that, when they occur, you'll receive a notification if you've subscribed with a listener. We'll have all the details at release, which is targeted for later this year.

0 Likes 0 ·
emaalouly1 avatar image emaalouly1 brendan commented ·

Well I never noticed that a game invite would take up to 40 seconds to be sent to my friend, it always seemed instant, that's why I was asking. But if it like that then I am no better than Xbox live or PSN, 30 seconds it is!

And thank you for the info Brendan, I'm always bothering you :)

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.