question

Dylan Hunt avatar image
Dylan Hunt asked

How would I go about inviting a friend to a party? The notification of invite? Push only for mobile?

I have Photon and Steam. For example, if I want to send a person an invite to my party, how would I go about doing this for a PC game?

Here's what I have in my head:

Option A:

  1. If I have their Playfab ID, could I have a custom info called like "pendingInvite" and make it null by default -- check every 15 seconds or so while at least 1 friend is online.
  2. Since there's no invite push call for PC that I know of (is there?), I should probably make a cloud code function to invite a friend. I could change pendingInvite = the player's playfab ID (I'm not good with cloud code yet, but I think I can do this).
  3. So when that 15 second check triggers and it's not null, pop up "you got an invite!" and clear it back to null.

Is there a better way of doing this, like with the PlayStream? Anything "pushy" for PC?

Option B:

  1. When I want to invite someone, I'll get their Steam ID from PlayFab FriendInfo.
  2. I'll then use Steamworks to push a game invite via Steamworks.
  3. SteamWorks event stream will pick it up and it'll ask for an invite via Steam (and I could show something in-game). If they accept, the original person's steamworks event stream will let them know they accepted - and I already have their info thanks to FriendInfo.

_____________________________

Then....... not quite sure how to both join the same room. Perhaps:

Player2 would get another FriendInfo call and keep doing it until the Player1.PhotonRoomNumber (or whatever it's called) is not null, or after x failed attempts.

Push NotificationsFriends
10 |1200

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

Joshua Strunk avatar image
Joshua Strunk answered

I would note that relying on push notifications for mobile is only really a hack anyway, not a solid solution.

The heartbeat style polling and steam methods should work, however every 15sec is excessive and likely to cause throttling. A key thing to remember is PlayFab is not a real-time messaging service, don't try to use it like one.

The solution we are going with is using another service to handle real-time messaging between users. This is very similar to using Steamworks, in out case our generic works on everything system of choice Photon Chat. If you want to add more authority to the system you can even due the write the PlayerData for invited and then on the sending players client send a ping to the receiving player to pull for the invite.

1 comment
10 |1200

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

Dylan Hunt avatar image Dylan Hunt commented ·

What is the minimum NOT considered realtime? I'm not worried about chat, can use Steam or Discord SDK (just got approved to their program), but in terms of notifications (friend invite, game invite), what's is 30s acceptable without throttles?

Interesting concept about pulling for invite, but seems a bit lame for 2017.

I wonder if you can include info within a steam invite, if I can invite to my own (Photons) server

0 Likes 0 ·
brendan avatar image
brendan answered

@Dylan Hunt (this got a bit too long for a Comment)

First, let me state that all the limits in the service have the flexibility to be changed based on custom contracts. So if you ever feel there's something you need, but the service limits prevent it, you can always talk to our business team about what it would cost to have exactly what you do need. Everything below assumes you do not have a custom contract with higher limits.

PlayFab is a Web API based service, so there's no socket connection to the client. We manage to keep our prices low and offer a free tier specifically by making sure that by default, titles don't make an excessive number of calls. In general, you should be aiming for only a few calls a minute on average, over the lifetime of the session for the user, across all calls. So bursts of calls are fine, as long as the average works out.

We've had "burst" rate limiting for some time now, and we're in the process of adding "long-term" rate limiting, in order to help developers get immediate feedback from the service as they build and test their games. As we establish those long-term rate limits, we'll also provide documentation detailing it. But yes, a system that frequently polls PlayFab for info would clearly run into that throttle.

We may be adding something akin to SignalR down the road, but for right now, I would simply not advise trying to build a system like that into the base service, as the polling rate would need to be long enough between calls to impact the user experience. Instead, I would recommend using a system which is specifically designed for real-time communications, like Photon Realtime, or else have your own custom game servers which manage those requests.

10 |1200

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

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.