GoGo V4 Mobile Push API Reference for Realtime Apps

Go to Storage & Playback


 

These docs are for PubNub 4.0 for Go which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.0 for Go.

If you have questions about the PubNub for Go SDK, please contact us at support@pubnub.com.

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the Go V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    Channels[]stringYeschannels to add to the channel group
    DeviceIDForPushstringYesDevice id.
    PushTypePNPushTypeGCM| PNPushTypeAPNSYesNot setAccepted values: PNPushTypeGCM, PNPushTypeAPNS.
    QueryParammap[string]stringOptionalQueryParam accepts a map, the keys and values of the map are passed as the query string parameters of the URL called by the API.
pn.AddPushNotificationsOnChannels().
		Channels([]string{"ch1"}).
		DeviceIDForPush("device_id").
		PushType(pubnub.PNPushTypeGCM).
		Execute()
The AddPushNotificationsOnChannels() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.Error.
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the Go V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    DeviceIDForPushstringYesDevice id.
    PushTypePNPushTypeGCM| PNPushTypeAPNSYesNot setAccepted values: PNPushTypeGCM, PNPushTypeAPNS.
    QueryParammap[string]stringOptionalQueryParam accepts a map, the keys and values of the map are passed as the query string parameters of the URL called by the API.
pn.ListPushProvisions().
		DeviceIDForPush("device_id").
		PushType(pubnub.PNPushTypeGCM).
		Execute()
The ListPushProvisions() operation returns a ListPushProvisionsRequestResponse which contains the following operations:
MethodTypeDescription
Channels[]stringList of channels subscribed for push notifications.
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels.
To run Removing Device From Channel you can use the following method(s) in the Go V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    Channels[]stringYeschannels to add to the channel group
    DeviceIDForPushstringYesDevice id.
    PushTypePNPushTypeGCM| PNPushTypeAPNSYesNot setAccepted values: PNPushTypeGCM, PNPushTypeAPNS.
    QueryParammap[string]stringOptionalQueryParam accepts a map, the keys and values of the map are passed as the query string parameters of the URL called by the API.
pn.RemovePushNotificationsFromChannels().
		Channels([]string{"ch"}).
		DeviceIDForPush("device_id").
		PushType(pubnub.PNPushTypeGCM).
		Execute()
The RemovePushNotificationsFromChannels() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.Error.
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications from all channels which is registered with specified pushToken.
To run Remove all push notifications you can use the following method(s) in the Go V4 SDK
  1. ParameterTypeRequiredDefaultsDescription
    DeviceIDForPushstringYesDevice id.
    PushTypePNPushTypeGCM| PNPushTypeAPNSYesNot setAccepted values: PNPushTypeGCM, PNPushTypeAPNS.
    QueryParammap[string]stringOptionalQueryParam accepts a map, the keys and values of the map are passed as the query string parameters of the URL called by the API.
pn.RemoveAllPushNotifications().
		DeviceIDForPush("device_id").
		PushType(pubnub.PNPushTypeGCM).
		Execute()
The RemoveAllPushNotifications() does not return actionable data, be sure to check the status object on the outcome of the operation by checking the status.Error.

Go to Objects (BETA)