# addServerPushEvent

open fun addServerPushEvent(event: ServerPushEvent)

Add a server push event listener to be called when server push message is arrived.

Example Usage:

    public class MyServerPushEventManager {
        ...
        private void handlingServerPushMessage() {
            Gamebase.addServerPushEvent(new ServerPushEvent() {
                @Override
                public void onReceive(ServerPushEventMessage message) {
                    if (message.type.equals(ServerPushEventMessage.Type.APP_KICKOUT)) {
                        Gamebase.logout(activity, new GamebaseCallback() {
                            @Override
                            public void onCallback(GamebaseException exception) {
                                MyGameManager.logoutAndReLaunching();
                            }
                        });
                    } else {
                        ...
                    }
                }
            });
        }
        ...
    }

Content copied to clipboard

#### Since

Added 1.8.0.

#### Parameters

event

The callback that will run.

#### See also

ServerPushEvent