-
Notifications
You must be signed in to change notification settings - Fork 9
User to User Messaging
Mat Hopwood edited this page Nov 8, 2018
·
3 revisions
Real time user to user messaging is not available via Facebook Instant Games (IG) so this is a none standard functionality. However, that said, it is possible to utilise real-time user to user messaging with IG by working directly with the Xtralife login system to log the user in anonymously then use the user to user messaging system that Xtralife provides to send messages around.
You can send an event (a message) to another user as follows:
if (FBInstant.ext !== undefined)
{
var msg = { message : "Here is a gift to you!", currency : 10 };
FBInstant.ext.sendEventAsync(user_id, msg).then(function(error, data)
{
if (error === null)
// Message sent
});
}
To retrieve any pending messages:
if (FBInstant.ext !== undefined)
{
FBInstant.ext.getEventsAsync().then(function(events)
{
// events contains array of received messages
});
}
