Previous topic

Messaging

Next topic

Members

This Page

Notifications

The notifications plugin enable online and offline notifications with different level of reliability, on all platforms. Notifications are only available in the game client (offline notifications are stored and delivered the next time the player connects to the game.)

The notification plugin provides a server side interface to enable other plugins and server component to send notifications.

Server installation

Install nuget package https://www.nuget.org/packages/Stormancer.Server.Plugins.Notification/ in the server app project.

Usage

Cpp

  • Add the notifications plugin to the project (notifications.hpp)

  • Add NotificationsPlugin to the client plugin list:

1
 config->addPlugin(new Stormancer::Notifications::NotificationsPlugin());
  • In UE4, add the Unreal/Notifications components to enable notifications related blueprint functions.

The notifications API can be obtained in the client by resolving the NotificationAPI object:

1
 auto notifications = client->dependencyResolver.resolve<Stormancer::Notifications::NotificationsApi>();

or in UE4:

1
 auto notifications = UStormancer::getApi<Stormancer::Notifications::NotificationsApi>();

The notification plugin stores a list of notifications that should be displayed to the user. Once a notification is displayed, the program is expected to call NotificationsApi::acknowledge(std::string notificationId) to inform the plugin that it shouldn’t present again the notification on restart if it’s transient. Notifications that require user confirmation are not discared when NotificationsApi::acknowledge(std::string notificationId) is called.

The program can remove notifications definitely by calling NotificationsApi::dismiss(std::string notificationId)

The program can subscribe to notifications by calling NotificationsApi::subscribe(callback)