public void BuildUnregisterDevicePushRequestCommon(bool ssl, string authKey, string pushToken, PushTypeService pushType)
        {
            string uuid = "customuuid";

            Pubnub pubnub = new Pubnub (
                Common.PublishKey,
                Common.SubscribeKey,
                "",
                "",
                ssl
            );
            pubnub.AuthenticationKey = authKey;
            string authKeyString = "";
            if (!string.IsNullOrEmpty(authKey)) {
                authKeyString = string.Format ("&auth={0}", pubnub.AuthenticationKey);
            }

            Uri uri = BuildRequests.BuildUnregisterDevicePushRequest (pushType, pushToken, uuid, ssl,
                pubnub.Origin, pubnub.AuthenticationKey, Common.SubscribeKey
            );
            //[1, "Removed Device"]
            //https://pubsub.pubnub.com/v1/push/sub-key/demo-36/devices/pushToken/remove?type=wns&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityIOS/3.6.9.0
            string expected = string.Format ("http{0}://{1}/v1/push/sub-key/{2}/devices/{3}/remove?type={4}&uuid={5}{6}&pnsdk={7}",
                ssl?"s":"", pubnub.Origin, Common.SubscribeKey, pushToken,
                pushType.ToString().ToLower(),
                uuid, authKeyString, PubnubUnity.Version
            );
            string received = uri.ToString ();
            UnityEngine.Debug.Log("exp:"+expected);
            UnityEngine.Debug.Log(received);
            Common.LogAndCompare (expected, received);
        }
示例#2
0
 public void GetChannelsForDevicePush(PushTypeService pushType, string pushToken, Action <object> userCallback, Action <PubnubClientError> errorCallback)
 {
     pubnub.GetChannelsForDevicePush <object>(pushType, pushToken, userCallback, errorCallback);
 }
示例#3
0
 public void RemoveChannelForDevicePush(string channel, PushTypeService pushType, string pushToken, Action <object> userCallback, Action <PubnubClientError> errorCallback)
 {
     pubnub.RemoveChannelForDevicePush <object>(channel, pushType, pushToken, userCallback, errorCallback);
 }
示例#4
0
 public void UnregisterDeviceForPush(PushTypeService pushType, string pushToken, Action <object> userCallback, Action <PubnubClientError> errorCallback)
 {
     pubnub.UnregisterDeviceForPush <object>(pushType, pushToken, userCallback, errorCallback);
 }
示例#5
0
 public void RegisterDeviceForPush <T>(string channel, PushTypeService pushType, string pushToken, Action <T> userCallback, Action <PubnubClientError> errorCallback)
 {
     pubnub.RegisterDeviceForPush <T>(channel, pushType, pushToken, userCallback, errorCallback);
 }
示例#6
0
        public void TestBuildRemoveChannelPushRequestCommon(bool ssl, string authKey, string pushToken, PushTypeService pushType)
        {
            string channel = "push_channel";
            string uuid    = "customuuid";

            Pubnub pubnub = new Pubnub(
                Common.PublishKey,
                Common.SubscribeKey,
                "",
                "",
                ssl
                );

            pubnub.AuthenticationKey = authKey;
            string authKeyString = "";

            if (!string.IsNullOrEmpty(authKey))
            {
                authKeyString = string.Format("&auth={0}", pubnub.AuthenticationKey);
            }

            Uri uri = BuildRequests.BuildRemoveChannelPushRequest(channel, pushType, pushToken, uuid, ssl,
                                                                  pubnub.Origin, pubnub.AuthenticationKey, Common.SubscribeKey
                                                                  );
            //[1, "Modified Channels"]
            //http://pubsub.pubnub.com/v1/push/sub-key/demo-36/devices/pushToken?remove=push_channel&type=mpns&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityIOS/3.6.9.0
            string expected = string.Format("http{0}://{1}/v1/push/sub-key/{2}/devices/{3}?remove={4}&type={5}&uuid={6}{7}&pnsdk={8}",
                                            ssl?"s":"", pubnub.Origin, Common.SubscribeKey, pushToken,
                                            Utility.EncodeUricomponent(channel, ResponseType.PushRemove, true, false), pushType.ToString().ToLower(),
                                            uuid, authKeyString, PubnubUnity.Version
                                            );
            string received = uri.ToString();

            UnityEngine.Debug.Log("exp:" + expected);
            UnityEngine.Debug.Log(received);
            Common.LogAndCompare(expected, received);
        }
示例#7
0
        public void BuildUnregisterDevicePushRequestCommon(bool ssl, string authKey, string pushToken, PushTypeService pushType)
        {
            string uuid = "customuuid";

            Pubnub pubnub = new Pubnub(
                Common.PublishKey,
                Common.SubscribeKey,
                "",
                "",
                ssl
                );

            pubnub.AuthenticationKey = authKey;
            string authKeyString = "";

            if (!string.IsNullOrEmpty(authKey))
            {
                authKeyString = string.Format("&auth={0}", pubnub.AuthenticationKey);
            }

            Uri uri = BuildRequests.BuildUnregisterDevicePushRequest(pushType, pushToken, uuid, ssl,
                                                                     pubnub.Origin, pubnub.AuthenticationKey, Common.SubscribeKey
                                                                     );
            //[1, "Removed Device"]
            //https://pubsub.pubnub.com/v1/push/sub-key/demo-36/devices/pushToken/remove?type=wns&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityIOS/3.6.9.0
            string expected = string.Format("http{0}://{1}/v1/push/sub-key/{2}/devices/{3}/remove?type={4}&uuid={5}{6}&pnsdk={7}",
                                            ssl?"s":"", pubnub.Origin, Common.SubscribeKey, pushToken,
                                            pushType.ToString().ToLower(),
                                            uuid, authKeyString, PubnubUnity.Version
                                            );
            string received = uri.ToString();

            UnityEngine.Debug.Log("exp:" + expected);
            UnityEngine.Debug.Log(received);
            Common.LogAndCompare(expected, received);
        }
        public void TestBuildRemoveChannelPushRequestCommon(bool ssl, string authKey, string pushToken, PushTypeService pushType)
        {
            string channel = "push_channel";
            string uuid = "customuuid";

            Pubnub pubnub = new Pubnub (
                Common.PublishKey,
                Common.SubscribeKey,
                "",
                "",
                ssl
            );
            pubnub.AuthenticationKey = authKey;
            string authKeyString = "";
            if (!string.IsNullOrEmpty(authKey)) {
                authKeyString = string.Format ("&auth={0}", pubnub.AuthenticationKey);
            }

            Uri uri = BuildRequests.BuildRemoveChannelPushRequest (channel, pushType, pushToken, uuid, ssl,
                pubnub.Origin, pubnub.AuthenticationKey, Common.SubscribeKey
            );
            //[1, "Modified Channels"]
            //http://pubsub.pubnub.com/v1/push/sub-key/demo-36/devices/pushToken?remove=push_channel&type=mpns&uuid=customuuid&auth=authKey&pnsdk=PubNub-CSharp-UnityIOS/3.6.9.0
            string expected = string.Format ("http{0}://{1}/v1/push/sub-key/{2}/devices/{3}?remove={4}&type={5}&uuid={6}{7}&pnsdk={8}",
                ssl?"s":"", pubnub.Origin, Common.SubscribeKey, pushToken,
                Utility.EncodeUricomponent(channel, ResponseType.PushRemove, true, false), pushType.ToString().ToLower(),
                uuid, authKeyString, PubnubUnity.Version
            );
            string received = uri.ToString ();
            UnityEngine.Debug.Log("exp:"+expected);
            UnityEngine.Debug.Log(received);
            Common.LogAndCompare (expected, received);
        }