Facebook Instant Games & Firebase, store & view pending challenges

Photo by Nhu Nguyen on Unsplash
Pending requests/challenges is a great feature to have, especially for multiplayer games, however Facebook SDK doesn’t really give us many tools to go on, currently the only way to see any pending challenges is via the native Facebook menu when calling chooseAsync
And this is where this article comes into play. In order to achieve this we use a simple functionality that includes the context match-id
and the opponentsuser-facebook-id
We will create two mechanics, one to receive Any
challenges in any context from anyone, and one to receive pending challenges for the current context (this is especially useful for games that require subsequent actions to happen and actually the existence of this mechanic actually allows these games to be…