diff --git a/src/Api/PubnubApi/ClientNetworkStatus.cs b/src/Api/PubnubApi/ClientNetworkStatus.cs index 1b683020e..d27270011 100644 --- a/src/Api/PubnubApi/ClientNetworkStatus.cs +++ b/src/Api/PubnubApi/ClientNetworkStatus.cs @@ -1,5 +1,4 @@ using System; -using System.Threading; using System.Threading.Tasks; using System.Globalization; using System.Collections.Generic; diff --git a/src/Api/PubnubApi/Interface/IPubnubHttp.cs b/src/Api/PubnubApi/Interface/IPubnubHttp.cs deleted file mode 100644 index 7358956be..000000000 --- a/src/Api/PubnubApi/Interface/IPubnubHttp.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Net; -using System.Threading.Tasks; - -namespace PubnubApi -{ - public interface IPubnubHttp - { - HttpWebRequest SetProxy(HttpWebRequest request); - - HttpWebRequest SetTimeout(RequestState pubnubRequestState, HttpWebRequest request); - - HttpWebRequest SetNoCache(HttpWebRequest request); - HttpWebRequest SetServicePointConnectionLimit(RequestState pubnubRequestState, HttpWebRequest request); - HttpWebRequest SetServicePointSetTcpKeepAlive(RequestState pubnubRequestState, HttpWebRequest request); - HttpWebRequest SetTcpKeepAlive(HttpWebRequest request); - - Task SendRequestAndGetJsonResponse(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request); - - Task SendRequestAndGetJsonResponseWithPOST(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request, byte[] postData, string contentType); - - Task SendRequestAndGetJsonResponseWithPATCH(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request, byte[] patchData, string contentType); - - Task SendRequestAndGetStreamResponse(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request); - } - -} diff --git a/src/Api/PubnubApi/Interface/IUrlRequestBuilder.cs b/src/Api/PubnubApi/Interface/IUrlRequestBuilder.cs deleted file mode 100644 index 687173a89..000000000 --- a/src/Api/PubnubApi/Interface/IUrlRequestBuilder.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace PubnubApi -{ - public interface IUrlRequestBuilder - { - Uri BuildTimeRequest(string requestMethod, string requestBody, Dictionary externalQueryParam); - - Uri BuildMultiChannelSubscribeRequest(string requestMethod, string requestBody, string[] channels, string[] channelGroups, long timetoken, int region, string channelsJsonState, Dictionary initialSubscribeUrlParams, Dictionary externalQueryParam); - - Uri BuildMultiChannelLeaveRequest(string requestMethod, string requestBody, string[] channels, string[] channelGroups, string jsonUserState, Dictionary externalQueryParam); - - Uri BuildPublishRequest(string requestMethod, string requestBody, string channel, object originalMessage, bool storeInHistory, int ttl, Dictionary userMetaData, Dictionary additionalUrlParams, Dictionary externalQueryParam); - - Uri BuildSignalRequest(string requestMethod, string requestBody, string channel, object originalMessage, Dictionary userMetaData, Dictionary externalQueryParam); - - Uri BuildHereNowRequest(string requestMethod, string requestBody, string[] channels, string[] channelGroups, bool showUUIDList, bool includeUserState, Dictionary externalQueryParam); - - Uri BuildHistoryRequest(string requestMethod, string requestBody, string channel, long start, long end, int count, bool reverse, bool includeToken, bool includeMeta, Dictionary externalQueryParam); - - Uri BuildFetchRequest(string requestMethod, string requestBody, string[] channels, long start, long end, int count, bool reverse, bool includeMeta, bool includeMessageActions, bool includeUuid, bool includeMessageType, Dictionary externalQueryParam); - - Uri BuildDeleteMessageRequest(string requestMethod, string requestBody, string channel, long start, long end, Dictionary externalQueryParam); - - Uri BuildWhereNowRequest(string requestMethod, string requestBody, string uuid, Dictionary externalQueryParam); - - Uri BuildGrantV2AccessRequest(string requestMethod, string requestBody, string channelsCommaDelimited, string channelGroupsCommaDelimited, string targetUuidsCommaDelimited, string authKeysCommaDelimited, bool read, bool write, bool delete, bool manage, bool get, bool update, bool join, long ttl, Dictionary externalQueryParam); - - Uri BuildGrantV3AccessRequest(string requestMethod, string requestBody, Dictionary externalQueryParam); - - Uri BuildRevokeV3AccessRequest(string requestMethod, string requestBody, string token, Dictionary externalQueryParam); - - Uri BuildAuditAccessRequest(string requestMethod, string requestBody, string channel, string channelGroup, string authKeysCommaDelimited, Dictionary externalQueryParam); - - Uri BuildGetUserStateRequest(string requestMethod, string requestBody, string channelsCommaDelimited, string channelGroupsCommaDelimited, string uuid, Dictionary externalQueryParam); - - Uri BuildSetUserStateRequest(string requestMethod, string requestBody, string channelsCommaDelimited, string channelGroupsCommaDelimited, string uuid, string jsonUserState, Dictionary externalQueryParam); - - Uri BuildAddChannelsToChannelGroupRequest(string requestMethod, string requestBody, string channelsCommaDelimited, string nameSpace, string groupName, Dictionary externalQueryParam); - - Uri BuildRemoveChannelsFromChannelGroupRequest(string requestMethod, string requestBody, string channelsCommaDelimited, string nameSpace, string groupName, Dictionary externalQueryParam); - - Uri BuildGetChannelsForChannelGroupRequest(string requestMethod, string requestBody, string nameSpace, string groupName, bool limitToChannelGroupScopeOnly, Dictionary externalQueryParam); - - Uri BuildGetAllChannelGroupRequest(string requestMethod, string requestBody, Dictionary externalQueryParam); - - Uri BuildRegisterDevicePushRequest(string requestMethod, string requestBody, string channel, PNPushType pushType, string pushToken, PushEnvironment environment, string deviceTopic, Dictionary externalQueryParam); - - Uri BuildUnregisterDevicePushRequest(string requestMethod, string requestBody, PNPushType pushType, string pushToken, PushEnvironment environment, string deviceTopic, Dictionary externalQueryParam); - - Uri BuildRemoveChannelPushRequest(string requestMethod, string requestBody, string channel, PNPushType pushType, string pushToken, PushEnvironment environment, string deviceTopic, Dictionary externalQueryParam); - - Uri BuildGetChannelsPushRequest(string requestMethod, string requestBody, PNPushType pushType, string pushToken, PushEnvironment environment, string deviceTopic, Dictionary externalQueryParam); - - Uri BuildPresenceHeartbeatRequest(string requestMethod, string requestBody, string[] channels, string[] channelGroups, string jsonUserState); - - Uri BuildMessageCountsRequest(string requestMethod, string requestBody, string[] channels, long[] timetokens, Dictionary externalQueryParam); - - Uri BuildSetUuidMetadataRequest(string requestMethod, string requestBody, string uuid, bool includeCustom, Dictionary externalQueryParam); - - Uri BuildDeleteUuidMetadataRequest(string requestMethod, string requestBody, string uuid, Dictionary externalQueryParam); - - Uri BuildGetAllUuidMetadataRequest(string requestMethod, string requestBody, string start, string end, int limit, bool includeCount, bool includeCustom, string filter, List sort, Dictionary externalQueryParam); - - Uri BuildGetSingleUuidMetadataRequest(string requestMethod, string requestBody, string uuid, bool includeCustom, Dictionary externalQueryParam); - - Uri BuildSetChannelMetadataRequest(string requestMethod, string requestBody, string channel, bool includeCustom, Dictionary externalQueryParam); - - Uri BuildDeleteChannelMetadataRequest(string requestMethod, string requestBody, string channel, Dictionary externalQueryParam); - - Uri BuildGetAllChannelMetadataRequest(string requestMethod, string requestBody, string start, string end, int limit, bool includeCount, bool includeCustom, string filter, List sort, Dictionary externalQueryParam); - - Uri BuildGetSingleChannelMetadataRequest(string requestMethod, string requestBody, string channel, bool includeCustom, Dictionary externalQueryParam); - - Uri BuildMembershipSetRemoveManageUserRequest(PNOperationType type, string requestMethod, string requestBody, string uuid, string start, string end, int limit, bool includeCount, string includeOptions, List sort, Dictionary externalQueryParam); - - Uri BuildMemberAddUpdateRemoveChannelRequest(string requestMethod, string requestBody, string channel, string start, string end, int limit, bool includeCount, string includeOptions, List sort, Dictionary externalQueryParam); - - Uri BuildGetAllMembershipsRequest(string requestMethod, string requestBody, string uuid, string start, string end, int limit, bool includeCount, string includeOptions, string filter, List sort, Dictionary externalQueryParam); - - Uri BuildGetAllMembersRequest(string requestMethod, string requestBody, string channel, string start, string end, int limit, bool includeCount, string includeOptions, string filter, List sort, Dictionary externalQueryParam); - - Uri BuildAddMessageActionRequest(string requestMethod, string requestBody, string channel, long messageTimetoken, Dictionary externalQueryParam); - - Uri BuildRemoveMessageActionRequest(string requestMethod, string requestBody, string channel, long messageTimetoken, long actionTimetoken, string messageActionUuid, Dictionary externalQueryParam); - - Uri BuildGetMessageActionsRequest(string requestMethod, string requestBody, string channel, long start, long end, int limit, Dictionary externalQueryParam); - - Uri BuildGenerateFileUploadUrlRequest(string requestMethod, string requestBody, string channel, Dictionary externalQueryParam); - - Uri BuildPublishFileMessageRequest(string requestMethod, string requestBody, string channel, object originalMessage, bool storeInHistory, int ttl, Dictionary userMetaData, Dictionary additionalUrlParams, Dictionary externalQueryParam); - - Uri BuildGetFileUrlOrDeleteReqest(string requestMethod, string requestBody, string channel, string fileId, string fileName, Dictionary externalQueryParam, PNOperationType operationType); - - Uri BuildListFilesReqest(string requestMethod, string requestBody, string channel, int limit, string nextToken, Dictionary externalQueryParam, PNOperationType operationType); - } -} diff --git a/src/Api/PubnubApi/PNConfiguration.cs b/src/Api/PubnubApi/PNConfiguration.cs index facf12316..1493e6188 100644 --- a/src/Api/PubnubApi/PNConfiguration.cs +++ b/src/Api/PubnubApi/PNConfiguration.cs @@ -1,8 +1,5 @@ using PubnubApi.Security.Crypto; using System; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; namespace PubnubApi { @@ -22,10 +19,7 @@ internal void ResetUuidSetFromConstructor() public int PresenceTimeout { - get - { - return presenceHeartbeatTimeout; - } + get => presenceHeartbeatTimeout; set { presenceHeartbeatTimeout = value; @@ -33,13 +27,7 @@ public int PresenceTimeout } } - public int PresenceInterval - { - get - { - return presenceHeartbeatInterval; - } - } + public int PresenceInterval => presenceHeartbeatInterval; public bool Secure { get; set; } @@ -61,10 +49,7 @@ public int PresenceInterval [Obsolete("Uuid is deprecated, please use UserId instead.")] public string Uuid { - get - { - return userId.ToString(); - } + get => userId.ToString(); set { if (userId != null && !uuidSetFromConstructor) @@ -85,10 +70,7 @@ public string Uuid public UserId UserId { - get - { - return userId; - } + get => userId; set { if (uuidSetFromConstructor) @@ -138,12 +120,6 @@ public PNReconnectionPolicy ReconnectionPolicy { public int RequestMessageCountThreshold { get; set; } = 100; - public bool UseClassicHttpWebRequest { get; set; } - - public bool UseTaskFactoryAsyncInsteadOfHttpClient { get; set; } - - public bool EnableTelemetry { get; set; } = true; - public int MaximumMessagesCacheSize { get; set; } public bool DedupOnSubscribe { get; set; } @@ -217,8 +193,8 @@ private void setDefaultRetryConfigurationFromPolicy(PNReconnectionPolicy policy) public PNConfiguration SetPresenceTimeoutWithCustomInterval(int timeout, int interval) { - this.presenceHeartbeatTimeout = timeout; - this.presenceHeartbeatInterval = interval; + presenceHeartbeatTimeout = timeout; + presenceHeartbeatInterval = interval; return this; } diff --git a/src/Api/PubnubApi/Pubnub.cs b/src/Api/PubnubApi/Pubnub.cs index ed6b6df92..2504995f1 100644 --- a/src/Api/PubnubApi/Pubnub.cs +++ b/src/Api/PubnubApi/Pubnub.cs @@ -20,8 +20,8 @@ public class Pubnub private ConcurrentDictionary pubnubConfig { get; } = new ConcurrentDictionary(); private IPubnubUnitTest pubnubUnitTest; private IPubnubLog pubnubLog; - private EndPoint.ListenerManager listenerManager; - private readonly EndPoint.TokenManager tokenManager; + private ListenerManager listenerManager; + private readonly TokenManager tokenManager; private object savedSubscribeOperation; private readonly string savedSdkVerion; private SubscribeEventEngineFactory subscribeEventEngineFactory; @@ -39,13 +39,9 @@ private List subscribeCallbackListenerList static Pubnub() { -#if NET35 || NET40 - var assemblyVersion = typeof(Pubnub).Assembly.GetName().Version; -#else var assembly = typeof(Pubnub).GetTypeInfo().Assembly; var assemblyName = new AssemblyName(assembly.FullName); string assemblyVersion = assemblyName.Version.ToString(); -#endif Version = string.Format(CultureInfo.InvariantCulture, "{0}CSharp{1}", PNPlatform.Get(), assemblyVersion); } @@ -69,15 +65,15 @@ public ISubscribeOperation Subscribe() if (pubnubConfig[InstanceId].PresenceInterval > 0) { presenceOperation = new PresenceOperation(this, InstanceId, pubnubLog, pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null , tokenManager, pubnubUnitTest ,presenceEventengineFactory); } - EndPoint.SubscribeEndpoint subscribeOperation = new EndPoint.SubscribeEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this.subscribeEventEngineFactory, presenceOperation, InstanceId ,this); - subscribeOperation.EventEmitter = this.eventEmitter; + SubscribeEndpoint subscribeOperation = new SubscribeEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, subscribeEventEngineFactory, presenceOperation, InstanceId ,this); + subscribeOperation.EventEmitter = eventEmitter; subscribeOperation.SubscribeListenerList = subscribeCallbackListenerList; savedSubscribeOperation = subscribeOperation; return subscribeOperation; } else { - EndPoint.SubscribeOperation subscribeOperation = new EndPoint.SubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SubscribeOperation subscribeOperation = new SubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); savedSubscribeOperation = subscribeOperation; return subscribeOperation; } @@ -87,271 +83,271 @@ public IUnsubscribeOperation Unsubscribe() { if (pubnubConfig[InstanceId].EnableEventEngine) { - EndPoint.UnsubscribeEndpoint unsubscribeOperation = new EndPoint.UnsubscribeEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, subscribeEventEngineFactory, presenceEventengineFactory, this); + UnsubscribeEndpoint unsubscribeOperation = new UnsubscribeEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, subscribeEventEngineFactory, presenceEventengineFactory, this); return unsubscribeOperation; } else { - EndPoint.UnsubscribeOperation unsubscribeOperation = new EndPoint.UnsubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + UnsubscribeOperation unsubscribeOperation = new UnsubscribeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); unsubscribeOperation.CurrentPubnubInstance(this); return unsubscribeOperation; } } - public EndPoint.UnsubscribeAllOperation UnsubscribeAll() + public UnsubscribeAllOperation UnsubscribeAll() { if (pubnubConfig[InstanceId].EnableEventEngine) { - EndPoint.UnsubscribeAllEndpoint unsubscribeAllEndpoint = new EndPoint.UnsubscribeAllEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, subscribeEventEngineFactory, presenceEventengineFactory, this); + UnsubscribeAllEndpoint unsubscribeAllEndpoint = new UnsubscribeAllEndpoint(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, subscribeEventEngineFactory, presenceEventengineFactory, this); return unsubscribeAllEndpoint; } else { - EndPoint.UnsubscribeAllOperation unSubscribeAllOperation = new EndPoint.UnsubscribeAllOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + UnsubscribeAllOperation unSubscribeAllOperation = new UnsubscribeAllOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return unSubscribeAllOperation; } } - public EndPoint.PublishOperation Publish() + public PublishOperation Publish() { - EndPoint.PublishOperation publishOperation = new EndPoint.PublishOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + PublishOperation publishOperation = new PublishOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); publishOperation.CurrentPubnubInstance(this); return publishOperation; } - public EndPoint.FireOperation Fire() + public FireOperation Fire() { - EndPoint.FireOperation fireOperation = new EndPoint.FireOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + FireOperation fireOperation = new FireOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); fireOperation.CurrentPubnubInstance(this); return fireOperation; } - public EndPoint.SignalOperation Signal() + public SignalOperation Signal() { - EndPoint.SignalOperation signalOperation = new EndPoint.SignalOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SignalOperation signalOperation = new SignalOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return signalOperation; } - public EndPoint.HistoryOperation History() + public HistoryOperation History() { - EndPoint.HistoryOperation historyOperaton = new EndPoint.HistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + HistoryOperation historyOperaton = new HistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return historyOperaton; } - public EndPoint.FetchHistoryOperation FetchHistory() + public FetchHistoryOperation FetchHistory() { - EndPoint.FetchHistoryOperation historyOperaton = new EndPoint.FetchHistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + FetchHistoryOperation historyOperaton = new FetchHistoryOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return historyOperaton; } - public EndPoint.DeleteMessageOperation DeleteMessages() + public DeleteMessageOperation DeleteMessages() { - EndPoint.DeleteMessageOperation deleteMessageOperaton = new EndPoint.DeleteMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + DeleteMessageOperation deleteMessageOperaton = new DeleteMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return deleteMessageOperaton; } - public EndPoint.MessageCountsOperation MessageCounts() + public MessageCountsOperation MessageCounts() { - EndPoint.MessageCountsOperation messageCount = new EndPoint.MessageCountsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + MessageCountsOperation messageCount = new MessageCountsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); messageCount.CurrentPubnubInstance(this); return messageCount; } - public EndPoint.HereNowOperation HereNow() + public HereNowOperation HereNow() { - EndPoint.HereNowOperation hereNowOperation = new EndPoint.HereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + HereNowOperation hereNowOperation = new HereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); hereNowOperation.CurrentPubnubInstance(this); return hereNowOperation; } - public EndPoint.WhereNowOperation WhereNow() + public WhereNowOperation WhereNow() { - EndPoint.WhereNowOperation whereNowOperation = new EndPoint.WhereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + WhereNowOperation whereNowOperation = new WhereNowOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); whereNowOperation.CurrentPubnubInstance(this); return whereNowOperation; } - public EndPoint.TimeOperation Time() + public TimeOperation Time() { - EndPoint.TimeOperation timeOperation = new EndPoint.TimeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); + TimeOperation timeOperation = new TimeOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); timeOperation.CurrentPubnubInstance(this); return timeOperation; } - public EndPoint.AuditOperation Audit() + public AuditOperation Audit() { - EndPoint.AuditOperation auditOperation = new EndPoint.AuditOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); + AuditOperation auditOperation = new AuditOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); auditOperation.CurrentPubnubInstance(this); return auditOperation; } - public EndPoint.GrantTokenOperation GrantToken() + public GrantTokenOperation GrantToken() { - EndPoint.GrantTokenOperation grantOperation = new EndPoint.GrantTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GrantTokenOperation grantOperation = new GrantTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return grantOperation; } - public EndPoint.RevokeTokenOperation RevokeToken() + public RevokeTokenOperation RevokeToken() { - EndPoint.RevokeTokenOperation revokeTokenOperation = new EndPoint.RevokeTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RevokeTokenOperation revokeTokenOperation = new RevokeTokenOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return revokeTokenOperation; } - public EndPoint.GrantOperation Grant() + public GrantOperation Grant() { - EndPoint.GrantOperation grantOperation = new EndPoint.GrantOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); + GrantOperation grantOperation = new GrantOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, this); grantOperation.CurrentPubnubInstance(this); return grantOperation; } - public EndPoint.SetStateOperation SetPresenceState() + public SetStateOperation SetPresenceState() { - EndPoint.SetStateOperation setStateOperation = new EndPoint.SetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SetStateOperation setStateOperation = new SetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return setStateOperation; } - public EndPoint.GetStateOperation GetPresenceState() + public GetStateOperation GetPresenceState() { - EndPoint.GetStateOperation getStateOperation = new EndPoint.GetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetStateOperation getStateOperation = new GetStateOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); getStateOperation.CurrentPubnubInstance(this); return getStateOperation; } - public EndPoint.AddPushChannelOperation AddPushNotificationsOnChannels() + public AddPushChannelOperation AddPushNotificationsOnChannels() { - EndPoint.AddPushChannelOperation addPushChannelOperation = new EndPoint.AddPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + AddPushChannelOperation addPushChannelOperation = new AddPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return addPushChannelOperation; } - public EndPoint.RemovePushChannelOperation RemovePushNotificationsFromChannels() + public RemovePushChannelOperation RemovePushNotificationsFromChannels() { - EndPoint.RemovePushChannelOperation removePushChannelOperation = new EndPoint.RemovePushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemovePushChannelOperation removePushChannelOperation = new RemovePushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removePushChannelOperation; } - public EndPoint.RemoveAllPushChannelsOperation RemoveAllPushNotificationsFromDeviceWithPushToken() + public RemoveAllPushChannelsOperation RemoveAllPushNotificationsFromDeviceWithPushToken() { - EndPoint.RemoveAllPushChannelsOperation removeAllPushChannelsOperation = new EndPoint.RemoveAllPushChannelsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveAllPushChannelsOperation removeAllPushChannelsOperation = new RemoveAllPushChannelsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); removeAllPushChannelsOperation.CurrentPubnubInstance(this); return removeAllPushChannelsOperation; } - public EndPoint.AuditPushChannelOperation AuditPushChannelProvisions() + public AuditPushChannelOperation AuditPushChannelProvisions() { - EndPoint.AuditPushChannelOperation auditPushChannelOperation = new EndPoint.AuditPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + AuditPushChannelOperation auditPushChannelOperation = new AuditPushChannelOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); auditPushChannelOperation.CurrentPubnubInstance(this); return auditPushChannelOperation; } - public EndPoint.SetUuidMetadataOperation SetUuidMetadata() + public SetUuidMetadataOperation SetUuidMetadata() { - EndPoint.SetUuidMetadataOperation setUuidMetadataOperation = new EndPoint.SetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SetUuidMetadataOperation setUuidMetadataOperation = new SetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return setUuidMetadataOperation; } - public EndPoint.RemoveUuidMetadataOperation RemoveUuidMetadata() + public RemoveUuidMetadataOperation RemoveUuidMetadata() { - EndPoint.RemoveUuidMetadataOperation removeUuidMetadataOperation = new EndPoint.RemoveUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveUuidMetadataOperation removeUuidMetadataOperation = new RemoveUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removeUuidMetadataOperation; } - public EndPoint.GetAllUuidMetadataOperation GetAllUuidMetadata() + public GetAllUuidMetadataOperation GetAllUuidMetadata() { - EndPoint.GetAllUuidMetadataOperation getAllUuidMetadataOperation = new EndPoint.GetAllUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetAllUuidMetadataOperation getAllUuidMetadataOperation = new GetAllUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getAllUuidMetadataOperation; } - public EndPoint.GetUuidMetadataOperation GetUuidMetadata() + public GetUuidMetadataOperation GetUuidMetadata() { - EndPoint.GetUuidMetadataOperation getUuidMetadataOperation = new EndPoint.GetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetUuidMetadataOperation getUuidMetadataOperation = new GetUuidMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getUuidMetadataOperation; } - public EndPoint.SetChannelMetadataOperation SetChannelMetadata() + public SetChannelMetadataOperation SetChannelMetadata() { - EndPoint.SetChannelMetadataOperation setChannelMetadataOperation = new EndPoint.SetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SetChannelMetadataOperation setChannelMetadataOperation = new SetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return setChannelMetadataOperation; } - public EndPoint.RemoveChannelMetadataOperation RemoveChannelMetadata() + public RemoveChannelMetadataOperation RemoveChannelMetadata() { - EndPoint.RemoveChannelMetadataOperation removeChannelMetadataOperation = new EndPoint.RemoveChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveChannelMetadataOperation removeChannelMetadataOperation = new RemoveChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removeChannelMetadataOperation; } - public EndPoint.GetAllChannelMetadataOperation GetAllChannelMetadata() + public GetAllChannelMetadataOperation GetAllChannelMetadata() { - EndPoint.GetAllChannelMetadataOperation getAllChannelMetadataOperation = new EndPoint.GetAllChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetAllChannelMetadataOperation getAllChannelMetadataOperation = new GetAllChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getAllChannelMetadataOperation; } - public EndPoint.GetChannelMetadataOperation GetChannelMetadata() + public GetChannelMetadataOperation GetChannelMetadata() { - EndPoint.GetChannelMetadataOperation getSingleSpaceOperation = new EndPoint.GetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetChannelMetadataOperation getSingleSpaceOperation = new GetChannelMetadataOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getSingleSpaceOperation; } - public EndPoint.GetMembershipsOperation GetMemberships() + public GetMembershipsOperation GetMemberships() { - EndPoint.GetMembershipsOperation getMembershipOperation = new EndPoint.GetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetMembershipsOperation getMembershipOperation = new GetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getMembershipOperation; } - public EndPoint.SetMembershipsOperation SetMemberships() + public SetMembershipsOperation SetMemberships() { - EndPoint.SetMembershipsOperation setMembershipsOperation = new EndPoint.SetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SetMembershipsOperation setMembershipsOperation = new SetMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return setMembershipsOperation; } - public EndPoint.RemoveMembershipsOperation RemoveMemberships() + public RemoveMembershipsOperation RemoveMemberships() { - EndPoint.RemoveMembershipsOperation removeMembershipsOperation = new EndPoint.RemoveMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveMembershipsOperation removeMembershipsOperation = new RemoveMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removeMembershipsOperation; } - public EndPoint.ManageMembershipsOperation ManageMemberships() + public ManageMembershipsOperation ManageMemberships() { - EndPoint.ManageMembershipsOperation manageMembershipsOperation = new EndPoint.ManageMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + ManageMembershipsOperation manageMembershipsOperation = new ManageMembershipsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return manageMembershipsOperation; } - public EndPoint.GetChannelMembersOperation GetChannelMembers() + public GetChannelMembersOperation GetChannelMembers() { - EndPoint.GetChannelMembersOperation getChannelMembersOperation = new EndPoint.GetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetChannelMembersOperation getChannelMembersOperation = new GetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getChannelMembersOperation; } - public EndPoint.SetChannelMembersOperation SetChannelMembers() + public SetChannelMembersOperation SetChannelMembers() { - EndPoint.SetChannelMembersOperation setChannelMembersOperation = new EndPoint.SetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SetChannelMembersOperation setChannelMembersOperation = new SetChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return setChannelMembersOperation; } - public EndPoint.RemoveChannelMembersOperation RemoveChannelMembers() + public RemoveChannelMembersOperation RemoveChannelMembers() { - EndPoint.RemoveChannelMembersOperation removeChannelMembersOperation = new EndPoint.RemoveChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveChannelMembersOperation removeChannelMembersOperation = new RemoveChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removeChannelMembersOperation; } - public EndPoint.ManageChannelMembersOperation ManageChannelMembers() + public ManageChannelMembersOperation ManageChannelMembers() { - EndPoint.ManageChannelMembersOperation channelMembersOperation = new EndPoint.ManageChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + ManageChannelMembersOperation channelMembersOperation = new ManageChannelMembersOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return channelMembersOperation; } - public EndPoint.AddMessageActionOperation AddMessageAction() + public AddMessageActionOperation AddMessageAction() { - EndPoint.AddMessageActionOperation addMessageActionOperation = new EndPoint.AddMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + AddMessageActionOperation addMessageActionOperation = new AddMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return addMessageActionOperation; } - public EndPoint.RemoveMessageActionOperation RemoveMessageAction() + public RemoveMessageActionOperation RemoveMessageAction() { - EndPoint.RemoveMessageActionOperation removeMessageActionOperation = new EndPoint.RemoveMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveMessageActionOperation removeMessageActionOperation = new RemoveMessageActionOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return removeMessageActionOperation; } - public EndPoint.GetMessageActionsOperation GetMessageActions() + public GetMessageActionsOperation GetMessageActions() { - EndPoint.GetMessageActionsOperation getMessageActionsOperation = new EndPoint.GetMessageActionsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetMessageActionsOperation getMessageActionsOperation = new GetMessageActionsOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getMessageActionsOperation; } @@ -359,37 +355,37 @@ public EndPoint.GetMessageActionsOperation GetMessageActions() #region "PubNub API Channel Group Methods" - public EndPoint.AddChannelsToChannelGroupOperation AddChannelsToChannelGroup() + public AddChannelsToChannelGroupOperation AddChannelsToChannelGroup() { - EndPoint.AddChannelsToChannelGroupOperation addChannelToChannelGroupOperation = new EndPoint.AddChannelsToChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + AddChannelsToChannelGroupOperation addChannelToChannelGroupOperation = new AddChannelsToChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); addChannelToChannelGroupOperation.CurrentPubnubInstance(this); return addChannelToChannelGroupOperation; } - public EndPoint.RemoveChannelsFromChannelGroupOperation RemoveChannelsFromChannelGroup() + public RemoveChannelsFromChannelGroupOperation RemoveChannelsFromChannelGroup() { - EndPoint.RemoveChannelsFromChannelGroupOperation removeChannelsFromChannelGroupOperation = new EndPoint.RemoveChannelsFromChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + RemoveChannelsFromChannelGroupOperation removeChannelsFromChannelGroupOperation = new RemoveChannelsFromChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); removeChannelsFromChannelGroupOperation.CurrentPubnubInstance(this); return removeChannelsFromChannelGroupOperation; } - public EndPoint.DeleteChannelGroupOperation DeleteChannelGroup() + public DeleteChannelGroupOperation DeleteChannelGroup() { - EndPoint.DeleteChannelGroupOperation deleteChannelGroupOperation = new EndPoint.DeleteChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + DeleteChannelGroupOperation deleteChannelGroupOperation = new DeleteChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); deleteChannelGroupOperation.CurrentPubnubInstance(this); return deleteChannelGroupOperation; } - public EndPoint.ListChannelsForChannelGroupOperation ListChannelsForChannelGroup() + public ListChannelsForChannelGroupOperation ListChannelsForChannelGroup() { - EndPoint.ListChannelsForChannelGroupOperation listChannelsForChannelGroupOperation = new EndPoint.ListChannelsForChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + ListChannelsForChannelGroupOperation listChannelsForChannelGroupOperation = new ListChannelsForChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); listChannelsForChannelGroupOperation.CurrentPubnubInstance(this); return listChannelsForChannelGroupOperation; } - public EndPoint.ListAllChannelGroupOperation ListChannelGroups() + public ListAllChannelGroupOperation ListChannelGroups() { - EndPoint.ListAllChannelGroupOperation listAllChannelGroupOperation = new EndPoint.ListAllChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + ListAllChannelGroupOperation listAllChannelGroupOperation = new ListAllChannelGroupOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); listAllChannelGroupOperation.CurrentPubnubInstance(this); return listAllChannelGroupOperation; } @@ -405,7 +401,7 @@ public bool AddListener(SubscribeCallback listener) { if (listenerManager == null) { - listenerManager = new EndPoint.ListenerManager(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + listenerManager = new ListenerManager(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); } return listenerManager.AddListener(listener); } @@ -422,58 +418,58 @@ public bool RemoveListener(SubscribeCallback listener) } #endregion - public EndPoint.SendFileOperation SendFile() + public SendFileOperation SendFile() { - EndPoint.SendFileOperation uploadFileOperation = new EndPoint.SendFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + SendFileOperation uploadFileOperation = new SendFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return uploadFileOperation; } - public EndPoint.GetFileUrlOperation GetFileUrl() + public GetFileUrlOperation GetFileUrl() { - EndPoint.GetFileUrlOperation getFileUrlOperation = new EndPoint.GetFileUrlOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + GetFileUrlOperation getFileUrlOperation = new GetFileUrlOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return getFileUrlOperation; } - public EndPoint.DownloadFileOperation DownloadFile() + public DownloadFileOperation DownloadFile() { - EndPoint.DownloadFileOperation downloadFileOperation = new EndPoint.DownloadFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + DownloadFileOperation downloadFileOperation = new DownloadFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return downloadFileOperation; } - public EndPoint.ListFilesOperation ListFiles() + public ListFilesOperation ListFiles() { - EndPoint.ListFilesOperation listFilesOperation = new EndPoint.ListFilesOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + ListFilesOperation listFilesOperation = new ListFilesOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return listFilesOperation; } - public EndPoint.DeleteFileOperation DeleteFile() + public DeleteFileOperation DeleteFile() { - EndPoint.DeleteFileOperation deleteFileOperation = new EndPoint.DeleteFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + DeleteFileOperation deleteFileOperation = new DeleteFileOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return deleteFileOperation; } - public EndPoint.PublishFileMessageOperation PublishFileMessage() + public PublishFileMessageOperation PublishFileMessage() { - EndPoint.PublishFileMessageOperation publshFileMessageOperation = new EndPoint.PublishFileMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + PublishFileMessageOperation publshFileMessageOperation = new PublishFileMessageOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); return publshFileMessageOperation; } #region "PubNub API Other Methods" public void TerminateCurrentSubscriberRequest() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + OtherOperation endpoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endpoint.CurrentPubnubInstance(this); endpoint.TerminateCurrentSubscriberRequest(); } public void EnableMachineSleepModeForTestingOnly() { - EndPoint.OtherOperation.EnableMachineSleepModeForTestingOnly(); + PubnubCoreBase.EnableMachineSleepModeForTestingOnly(); } public void DisableMachineSleepModeForTestingOnly() { - EndPoint.OtherOperation.DisableMachineSleepModeForTestingOnly(); + PubnubCoreBase.DisableMachineSleepModeForTestingOnly(); } public Guid GenerateGuid() @@ -497,43 +493,43 @@ public void ChangeUserId(UserId newUserId) } throw new MissingMemberException("UserId cannot be null/empty"); } - this.PNConfig.UserId = newUserId; - EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + PNConfig.UserId = newUserId; + OtherOperation endPoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endPoint.CurrentPubnubInstance(this); } public static long TranslateDateTimeToPubnubUnixNanoSeconds(DateTime dotNetUTCDateTime) { - return EndPoint.OtherOperation.TranslateDateTimeToPubnubUnixNanoSeconds(dotNetUTCDateTime); + return OtherOperation.TranslateDateTimeToPubnubUnixNanoSeconds(dotNetUTCDateTime); } public static DateTime TranslatePubnubUnixNanoSecondsToDateTime(long unixNanoSecondTime) { - return EndPoint.OtherOperation.TranslatePubnubUnixNanoSecondsToDateTime(unixNanoSecondTime); + return OtherOperation.TranslatePubnubUnixNanoSecondsToDateTime(unixNanoSecondTime); } public static DateTime TranslatePubnubUnixNanoSecondsToDateTime(string unixNanoSecondTime) { - return EndPoint.OtherOperation.TranslatePubnubUnixNanoSecondsToDateTime(unixNanoSecondTime); + return OtherOperation.TranslatePubnubUnixNanoSecondsToDateTime(unixNanoSecondTime); } public UserId GetCurrentUserId() { - EndPoint.OtherOperation endPoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + OtherOperation endPoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endPoint.CurrentPubnubInstance(this); return endPoint.GetCurrentUserId(); } public List GetSubscribedChannels() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + OtherOperation endpoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endpoint.CurrentPubnubInstance(this); return endpoint.GetSubscribedChannels(); } public List GetSubscribedChannelGroups() { - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + OtherOperation endpoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endpoint.CurrentPubnubInstance(this); return endpoint.GetSubscribedChannelGroups(); } @@ -541,7 +537,7 @@ public List GetSubscribedChannelGroups() public void Destroy() { savedSubscribeOperation = null; - EndPoint.OtherOperation endpoint = new EndPoint.OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); + OtherOperation endpoint = new OtherOperation(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, JsonPluggableLibrary, pubnubUnitTest, pubnubLog, tokenManager, this); endpoint.CurrentPubnubInstance(this); endpoint.EndPendingRequests(); } @@ -597,8 +593,8 @@ public bool Reconnect() }); } } else { - if (savedSubscribeOperation is EndPoint.SubscribeOperation) { - EndPoint.SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as EndPoint.SubscribeOperation; + if (savedSubscribeOperation is SubscribeOperation) { + SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as SubscribeOperation; if (subscibeOperationInstance != null) { ret = subscibeOperationInstance.Retry(true, false); } @@ -634,9 +630,9 @@ public bool Reconnect(bool resetSubscribeTimetoken) } else { - if (savedSubscribeOperation is EndPoint.SubscribeOperation) + if (savedSubscribeOperation is SubscribeOperation) { - EndPoint.SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as EndPoint.SubscribeOperation; + SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as SubscribeOperation; if (subscibeOperationInstance != null) { ret = subscibeOperationInstance.Retry(true, resetSubscribeTimetoken); @@ -664,9 +660,9 @@ public bool Disconnect() } else { - if (savedSubscribeOperation is EndPoint.SubscribeOperation) + if (savedSubscribeOperation is SubscribeOperation) { - EndPoint.SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as EndPoint.SubscribeOperation; + SubscribeOperation subscibeOperationInstance = savedSubscribeOperation as SubscribeOperation; if (subscibeOperationInstance != null) { ret = subscibeOperationInstance.Retry(false); @@ -809,8 +805,7 @@ public void EncryptFile(string sourceFile, string destinationFile, string cipher { throw new ArgumentException("sourceFile is not valid"); } - -#if !NETSTANDARD10 && !NETSTANDARD11 + bool validSource = System.IO.File.Exists(sourceFile); if (!validSource) { @@ -825,9 +820,6 @@ public void EncryptFile(string sourceFile, string destinationFile, string cipher byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); byte[] outputBytes = EncryptFile(inputBytes, cipherKey); System.IO.File.WriteAllBytes(destinationFile, outputBytes); -#else - throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); -#endif } public byte[] DecryptFile(byte[] inputBytes) @@ -864,7 +856,6 @@ public void DecryptFile(string sourceFile, string destinationFile) { throw new ArgumentException("CryptoModule missing"); } - #if !NETSTANDARD10 && !NETSTANDARD11 bool validSource = System.IO.File.Exists(sourceFile); if (!validSource) { @@ -879,9 +870,6 @@ public void DecryptFile(string sourceFile, string destinationFile) byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); byte[] outputBytes = DecryptFile(inputBytes); System.IO.File.WriteAllBytes(destinationFile, outputBytes); - #else - throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); - #endif } else { @@ -904,7 +892,6 @@ public void DecryptFile(string sourceFile, string destinationFile, string cipher { throw new ArgumentException("inputFile is not valid"); } -#if !NETSTANDARD10 && !NETSTANDARD11 bool validSource = System.IO.File.Exists(sourceFile); if (!validSource) { @@ -919,40 +906,21 @@ public void DecryptFile(string sourceFile, string destinationFile, string cipher byte[] inputBytes = System.IO.File.ReadAllBytes(sourceFile); byte[] outputBytes = DecryptFile(inputBytes, cipherKey); System.IO.File.WriteAllBytes(destinationFile, outputBytes); -#else - throw new NotSupportedException("FileSystem not supported in NetStandard 1.0/1.1. Consider higher version of .NetStandard."); -#endif } #endregion #region "Properties" public IPubnubUnitTest PubnubUnitTest { - get - { - return pubnubUnitTest; - } + get => pubnubUnitTest; set { pubnubUnitTest = value; - if (pubnubUnitTest != null) - { - Version = pubnubUnitTest.SdkVersion; - } - else - { - Version = savedSdkVerion; - } + Version = pubnubUnitTest != null ? pubnubUnitTest.SdkVersion : savedSdkVerion; } } - public PNConfiguration PNConfig - { - get - { - return pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null; - } - } + public PNConfiguration PNConfig => pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null; public IJsonPluggableLibrary JsonPluggableLibrary { get; internal set; } @@ -963,8 +931,7 @@ public void SetJsonPluggableLibrary(IJsonPluggableLibrary customJson) public static string Version { get; private set; } - internal IHttpClientService httpClientService; - internal Middleware transportMiddleware; + internal readonly ITransportMiddleware transportMiddleware; public string InstanceId { get; private set; } @@ -1000,12 +967,10 @@ public Pubnub(PNConfiguration config) } CheckAndInitializeEmptyStringValues(config); - tokenManager = new EndPoint.TokenManager(pubnubConfig[InstanceId], JsonPluggableLibrary, pubnubLog, this.InstanceId); + tokenManager = new TokenManager(pubnubConfig[InstanceId], JsonPluggableLibrary, pubnubLog, InstanceId); - //Initialize JsonPluggableLibrary JsonPluggableLibrary = new NewtonsoftJsonDotNet(config, pubnubLog); - //Check PresenceTimeout if (config.PresenceTimeout < 20) { config.PresenceTimeout = 20; @@ -1014,13 +979,10 @@ public Pubnub(PNConfiguration config) LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, WARNING: The PresenceTimeout cannot be less than 20, defaulting the value to 20. Please update the settings in your code.", DateTime.Now.ToString(CultureInfo.InvariantCulture)), config.LogVerbosity); } } - - //Check required UserId CheckRequiredUserId(config); eventEmitter = new EventEmitter(pubnubConfig.ContainsKey(InstanceId) ? pubnubConfig[InstanceId] : null, subscribeCallbackListenerList, JsonPluggableLibrary, tokenManager, pubnubLog, this); - //Check CryptoModule usage CheckCryptoModuleUsageForLogging(config); - httpClientService = new HttpClientService(); + IHttpClientService httpClientService = new HttpClientService(config.Proxy); transportMiddleware = new Middleware(httpClientService,config, this, tokenManager); } @@ -1041,8 +1003,7 @@ private void CheckRequiredUserId(PNConfiguration config) } throw new MissingMemberException("PNConfiguration.UserId is required to use the SDK"); } - - //Set flag to false + config.ResetUuidSetFromConstructor(); } private void CheckCryptoModuleUsageForLogging(PNConfiguration config) diff --git a/src/Api/PubnubApi/PubnubCoreBase.cs b/src/Api/PubnubApi/PubnubCoreBase.cs index 6b44294ec..f096ba619 100644 --- a/src/Api/PubnubApi/PubnubCoreBase.cs +++ b/src/Api/PubnubApi/PubnubCoreBase.cs @@ -1,5 +1,4 @@ -//Build Date: April 13, 2017 -#region "Header" +#region "Header" #if (__MonoCS__) #define TRACE #endif @@ -13,11 +12,6 @@ using System.Threading; using System.Globalization; using System.Linq; -using System.Threading.Tasks; -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -//using System.Net.Http; -//using System.Net.Http.Headers; -//#endif using PubnubApi.Security.Crypto; using PubnubApi.Security.Crypto.Cryptors; using System.Collections.Concurrent; @@ -39,8 +33,7 @@ public abstract class PubnubCoreBase private const int MINEXPONENTIALBACKOFF = 1; private const int MAXEXPONENTIALBACKOFF = 32; private const int INTERVAL = 3; - - private static IPubnubHttp pubnubHttp; + private static ConcurrentDictionary pubnubConfig { get; } = new ConcurrentDictionary(); private static IJsonPluggableLibrary jsonLib; private static IPubnubUnitTest unitTest; @@ -1846,7 +1839,6 @@ internal void EndPendingRequests() } RemoveChannelDictionary(); - //TerminatePendingWebRequest(); TerminateReconnectTimer(); RemoveUserState(); TerminatePresenceHeartbeatTimer(); @@ -1882,19 +1874,9 @@ internal void EndPendingRequests() { ChannelGroupUserState[PubnubInstance.InstanceId].Clear(); } - - if (MultiChannelSubscribe.Count > 0 && !MultiChannelSubscribe.Where(t => t.Value.Keys.Count > 0).Any() - && MultiChannelGroupSubscribe.Count > 0 && !MultiChannelGroupSubscribe.Where(t => t.Value.Keys.Count > 0).Any()) - { - RemoveHttpClients(); - } + PubnubInstance = null; } - - internal static void RemoveHttpClients() - { - //Conditionalmethod logic - } internal void TerminateCurrentSubscriberRequest() { diff --git a/src/Api/PubnubApi/PubnubHttp.cs b/src/Api/PubnubApi/PubnubHttp.cs deleted file mode 100644 index b8efcd42a..000000000 --- a/src/Api/PubnubApi/PubnubHttp.cs +++ /dev/null @@ -1,1365 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using System.Threading; -//using System.IO; -//using System.Net; -//using System.Collections; -//using System.Threading.Tasks; -//using System.Globalization; -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -//using System.Net.Http; -//using System.Net.Http.Headers; -//#endif - -//namespace PubnubApi -//{ -// public class PubnubHttp : IPubnubHttp -// { -// private readonly PNConfiguration pubnubConfig; -// private readonly IJsonPluggableLibrary jsonLib; -// private readonly IPubnubLog pubnubLog; -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// private static HttpClient httpClientSubscribe; -// private static HttpClient httpClientNonsubscribe; -//#endif - -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// public PubnubHttp(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubLog log, HttpClient refHttpClientSubscribe, HttpClient refHttpClientNonsubscribe) -//#else -// public PubnubHttp(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubLog log) -//#endif -// { -// pubnubConfig = config; -// jsonLib = jsonPluggableLibrary; -// pubnubLog = log; -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// httpClientSubscribe = refHttpClientSubscribe; -// httpClientNonsubscribe = refHttpClientNonsubscribe; -//#endif -// } - -// HttpWebRequest IPubnubHttp.SetProxy(HttpWebRequest request) -// { -//#if !NETSTANDARD10 -// if (pubnubConfig.Proxy != null) -// { -// request.Proxy = pubnubConfig.Proxy; -// } -//#endif -// return request; -// } - -// HttpWebRequest IPubnubHttp.SetTimeout(RequestState pubnubRequestState, HttpWebRequest request) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// request.Timeout = GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000; -//#endif -// return request; -// } - -// HttpWebRequest IPubnubHttp.SetNoCache(HttpWebRequest request) -// { -// request.Headers["Cache-Control"] = "no-cache"; -// request.Headers["Pragma"] = "no-cache"; - -// return request; -// } - -// HttpWebRequest IPubnubHttp.SetServicePointConnectionLimit(RequestState pubnubRequestState, HttpWebRequest request) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// if (pubnubRequestState.ResponseType == PNOperationType.PNHeartbeatOperation) -// { -// int estimateConnectionLimit = pubnubConfig.SubscribeTimeout/pubnubConfig.PresenceInterval; -// if (estimateConnectionLimit > request.ServicePoint.ConnectionLimit) -// { -// request.ServicePoint.ConnectionLimit = estimateConnectionLimit; -// } -// } -//#endif -// return request; -// } - -// HttpWebRequest IPubnubHttp.SetServicePointSetTcpKeepAlive(RequestState pubnubRequestState, HttpWebRequest request) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// if (pubnubConfig.PresenceInterval > 0) -// { -// request.ServicePoint.SetTcpKeepAlive(true, pubnubConfig.PresenceInterval * 1000, 1000); -// } -//#endif -// return request; -// } - -// HttpWebRequest IPubnubHttp.SetTcpKeepAlive(HttpWebRequest request) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// request.KeepAlive = true; -//#endif -// return request; -// } - -// async Task IPubnubHttp.SendRequestAndGetJsonResponse(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request) -// { -// if (pubnubConfig.UseClassicHttpWebRequest) -// { -// return await SendRequestAndGetJsonResponseClassicHttp(requestUri, pubnubRequestState, request).ConfigureAwait(false); -// } -// else -// { -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) -// { -// return await SendRequestAndGetJsonResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); -// } -// else -// { -// return await SendRequestAndGetJsonResponseHttpClient(requestUri, pubnubRequestState, request).ConfigureAwait(false); -// } -//#else -// return await SendRequestAndGetJsonResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); -//#endif -// } - -// } - -// async Task IPubnubHttp.SendRequestAndGetStreamResponse(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request) -// { -// if (pubnubConfig.UseClassicHttpWebRequest) -// { -// return await SendRequestAndGetStreamResponseClassicHttp(pubnubRequestState, request).ConfigureAwait(false); -// } -// else -// { -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) -// { -// return await SendRequestAndGetStreamResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); -// } -// else -// { -// return await SendRequestAndGetStreamResponseHttpClient(requestUri, pubnubRequestState).ConfigureAwait(false); -// } -//#else -// return await SendRequestAndGetStreamResponseTaskFactory(pubnubRequestState, request).ConfigureAwait(false); -//#endif -// } - -// } - -// async Task IPubnubHttp.SendRequestAndGetJsonResponseWithPOST(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request, byte[] postData, string contentType) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, postData bytearray len= {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), postData.Length), pubnubConfig.LogVerbosity); -// if (pubnubConfig.UseClassicHttpWebRequest) -// { -// return await SendRequestAndGetJsonResponseClassicHttpWithPOST(pubnubRequestState, request, postData, contentType).ConfigureAwait(false); -// } -// else -// { -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) -// { -// return await SendRequestAndGetJsonResponseTaskFactoryWithPOST(pubnubRequestState, request, postData, contentType).ConfigureAwait(false); -// } -// else -// { -// return await SendRequestAndGetJsonResponseHttpClientWithPOST(requestUri, pubnubRequestState, postData, contentType).ConfigureAwait(false); -// } -//#else -// return await SendRequestAndGetJsonResponseTaskFactoryWithPOST(pubnubRequestState, request, postData, contentType).ConfigureAwait(false); -//#endif -// } -// } - -// async Task IPubnubHttp.SendRequestAndGetJsonResponseWithPATCH(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request, byte[] patchData, string contentType) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, patchData = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), Encoding.UTF8.GetString(patchData, 0, patchData.Length)), pubnubConfig.LogVerbosity); -// if (pubnubConfig.UseClassicHttpWebRequest) -// { -// return await SendRequestAndGetJsonResponseClassicHttpWithPATCH(pubnubRequestState, request, patchData).ConfigureAwait(false); -// } -// else -// { -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient) -// { -// return await SendRequestAndGetJsonResponseTaskFactoryWithPATCH(pubnubRequestState, request, patchData, contentType).ConfigureAwait(false); -// } -// else -// { -// return await SendRequestAndGetJsonResponseHttpClientWithPATCH(requestUri, pubnubRequestState, patchData, contentType).ConfigureAwait(false); -// } -//#else -// return await SendRequestAndGetJsonResponseTaskFactoryWithPATCH(pubnubRequestState, request, patchData, contentType).ConfigureAwait(false); -//#endif -// } -// } - -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -// async Task SendRequestAndGetJsonResponseHttpClient(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request) -// { -// string jsonString = ""; -// HttpResponseMessage response = null; -// CancellationTokenSource cts = new CancellationTokenSource(); -// try -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetJsonResponseHttpClient", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// cts.CancelAfter(GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// if (pubnubRequestState.ResponseType == PNOperationType.PNSubscribeOperation) -// { -// response = await httpClientSubscribe.GetAsync(requestUri, cts.Token).ConfigureAwait(false); -// } -// else if (string.Compare(FindHttpGetOrDeleteMethod(pubnubRequestState), "DELETE", StringComparison.CurrentCultureIgnoreCase) == 0) -// { -// response = await httpClientNonsubscribe.DeleteAsync(requestUri, cts.Token).ConfigureAwait(false); -// } -// else -// { -// response = await httpClientNonsubscribe.GetAsync(requestUri, cts.Token).ConfigureAwait(false); -// } -// if (response.IsSuccessStatusCode || response.Content != null) -// { -// var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); -// stopWatch.Stop(); -// using (StreamReader streamReader = new StreamReader(stream)) -// { -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// pubnubRequestState.GotJsonResponse = true; -// } -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } -// else -// { -// stopWatch.Stop(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, No HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } - -// } -// catch (HttpRequestException httpReqEx) -// { -// if (httpReqEx.InnerException is WebException) -// { -// WebException currentWebException = httpReqEx.InnerException as WebException; -// if (currentWebException != null) -// { -// if (currentWebException.Response != null) -// { -// pubnubRequestState.Response = currentWebException.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(currentWebException.Response.GetResponseStream())) -// { -// //Need to return this response -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from HttpClient WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClient InnerException WebException status {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((WebException)httpReqEx.InnerException).Status.ToString()), pubnubConfig.LogVerbosity); -// throw httpReqEx.InnerException; -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClient HttpRequestException {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), httpReqEx.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// catch (Exception ex) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClient Exception {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// finally -// { -// if (response != null && response.Content != null) -// { -// response.Content.Dispose(); -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } -// } -// return jsonString; -// } - -// async Task SendRequestAndGetStreamResponseHttpClient(Uri requestUri, RequestState pubnubRequestState) -// { -// byte[] streamBytes = null; -// HttpResponseMessage response = null; -// CancellationTokenSource cts = new CancellationTokenSource(); -// try -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetStreamResponseHttpClient", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// cts.CancelAfter(GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// response = await httpClientNonsubscribe.GetAsync(requestUri, cts.Token).ConfigureAwait(false); -// if (response.IsSuccessStatusCode || response.Content != null) -// { -// var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); -// stopWatch.Stop(); -// using (MemoryStream ms = new MemoryStream()) -// { -// stream.CopyTo(ms); -// streamBytes = ms.ToArray(); -// } -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } -// else -// { -// stopWatch.Stop(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, No HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } - -// } -// catch (HttpRequestException httpReqEx) -// { -// if (httpReqEx.InnerException is WebException) -// { -// WebException currentWebException = httpReqEx.InnerException as WebException; -// if (currentWebException != null) -// { -// if (currentWebException.Response != null) -// { -// pubnubRequestState.Response = currentWebException.Response as HttpWebResponse; -// var errorStream = currentWebException.Response.GetResponseStream(); -// using (MemoryStream ms = new MemoryStream()) -// { -// errorStream.CopyTo(ms); -// streamBytes = ms.ToArray(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved Stream Bytes from HttpClient WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// } -// } -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetStreamResponseHttpClient InnerException WebException status {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((WebException)httpReqEx.InnerException).Status.ToString()), pubnubConfig.LogVerbosity); -// throw httpReqEx.InnerException; -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetStreamResponseHttpClient HttpRequestException {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), httpReqEx.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// catch (Exception ex) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetStreamResponseHttpClient Exception {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// finally -// { -// if (response != null && response.Content != null) -// { -// response.Content.Dispose(); -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } -// } -// return streamBytes; -// } - -// async Task SendRequestAndGetJsonResponseHttpClientWithPOST(Uri requestUri, RequestState pubnubRequestState, byte[] postData, string contentType) -// { -// string jsonString = ""; -// HttpResponseMessage response = null; -// CancellationTokenSource cts = new CancellationTokenSource(); -// try -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, SendRequestAndGetJsonResponseHttpClientPOST Before httpClient.GetAsync", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// cts.CancelAfter(GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// ByteArrayContent postDataContent = new ByteArrayContent(postData); -// postDataContent.Headers.Remove("Content-Type"); -// if (string.IsNullOrEmpty(contentType)) -// { -// postDataContent.Headers.TryAddWithoutValidation("Content-Type", "application/json"); -// } -// else -// { -// postDataContent.Headers.TryAddWithoutValidation("Content-Type", contentType); -// } -// if (pubnubRequestState.ResponseType == PNOperationType.PNSubscribeOperation) -// { -// response = await httpClientSubscribe.PostAsync(requestUri, postDataContent, cts.Token).ConfigureAwait(false); -// } -// else -// { -// response = await httpClientNonsubscribe.PostAsync(requestUri, postDataContent, cts.Token).ConfigureAwait(false); -// } - -// if (response.IsSuccessStatusCode || response.Content != null) -// { -// stopWatch.Stop(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got POST HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// if ((int)response.StatusCode == 204 && pubnubRequestState.ResponseType == PNOperationType.PNFileUploadOperation) -// { -// return "{}"; -// } -// else -// { -// var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); -// using (StreamReader streamReader = new StreamReader(stream)) -// { -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// pubnubRequestState.GotJsonResponse = true; -// } -// } -// } -// else -// { -// stopWatch.Stop(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, No POST HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } - -// } -// catch (HttpRequestException httpReqEx) -// { -// if (httpReqEx.InnerException is WebException) -// { -// WebException currentWebException = httpReqEx.InnerException as WebException; -// if (currentWebException != null) -// { -// if (currentWebException.Response != null) -// { -// pubnubRequestState.Response = currentWebException.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(currentWebException.Response.GetResponseStream())) -// { -// //Need to return this response -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from HttpClient POST WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST InnerException WebException status {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((WebException)httpReqEx.InnerException).Status.ToString()), pubnubConfig.LogVerbosity); -// throw httpReqEx.InnerException; -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST HttpRequestException {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), httpReqEx.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// catch (Exception ex) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST Exception {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// finally -// { -// if (response != null && response.Content != null) -// { -// response.Content.Dispose(); -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } -// } -// return jsonString; -// } - -// async Task SendRequestAndGetJsonResponseHttpClientWithPATCH(Uri requestUri, RequestState pubnubRequestState, byte[] patchData, string contentType) -// { -// string jsonString = ""; -// HttpResponseMessage response = null; -// CancellationTokenSource cts = new CancellationTokenSource(); -// try -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, SendRequestAndGetJsonResponseHttpClientWithPATCH Before httpClient.SendAsync", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// cts.CancelAfter(GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// HttpMethod httpMethod = new HttpMethod("PATCH"); -// ByteArrayContent patchDataContent = new ByteArrayContent(patchData); -// patchDataContent.Headers.Remove("Content-Type"); -// if (string.IsNullOrEmpty(contentType)) -// { -// patchDataContent.Headers.TryAddWithoutValidation("Content-Type", "application/json"); -// } -// else -// { -// patchDataContent.Headers.TryAddWithoutValidation("Content-Type", contentType); -// } - -// HttpRequestMessage requestMsg = new HttpRequestMessage(httpMethod, requestUri) -// { -// Content = patchDataContent -// }; -// if (pubnubRequestState.ResponseType == PNOperationType.PNSubscribeOperation) -// { -// response = await httpClientSubscribe.SendAsync(requestMsg, cts.Token).ConfigureAwait(false); -// } -// else -// { -// response = await httpClientNonsubscribe.SendAsync(requestMsg, cts.Token).ConfigureAwait(false); -// } - -// if (response.IsSuccessStatusCode || response.Content != null) -// { -// var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); -// stopWatch.Stop(); -// using (StreamReader streamReader = new StreamReader(stream)) -// { -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// pubnubRequestState.GotJsonResponse = true; -// } -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got POST HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } -// else -// { -// stopWatch.Stop(); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, No POST HttpResponseMessage for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), requestUri)); -// } - -// } -// catch (HttpRequestException httpReqEx) -// { -// if (httpReqEx.InnerException is WebException) -// { -// WebException currentWebException = httpReqEx.InnerException as WebException; -// if (currentWebException != null) -// { -// if (currentWebException.Response != null) -// { -// pubnubRequestState.Response = currentWebException.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(currentWebException.Response.GetResponseStream())) -// { -// //Need to return this response -// jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from HttpClient POST WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST InnerException WebException status {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ((WebException)httpReqEx.InnerException).Status.ToString()), pubnubConfig.LogVerbosity); -// throw httpReqEx.InnerException; -// } - -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST HttpRequestException {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), httpReqEx.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// catch (Exception ex) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, SendRequestAndGetJsonResponseHttpClientPOST Exception {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex.Message), pubnubConfig.LogVerbosity); -// throw; -// } -// finally -// { -// if (response != null && response.Content != null) -// { -// response.Content.Dispose(); -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } -// } -// return jsonString; -// } -//#endif - -// async Task SendRequestAndGetJsonResponseTaskFactory(RequestState pubnubRequestState, HttpWebRequest request) -// { -// HttpWebResponse response = null; -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetJsonResponseTaskFactory", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// try -// { -// request.Method = FindHttpGetOrDeleteMethod(pubnubRequestState); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// var _ = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// response = await Task.Factory.FromAsync(request.BeginGetResponse, asyncPubnubResult => (HttpWebResponse)request.EndGetResponse(asyncPubnubResult), pubnubRequestState).ConfigureAwait(false); -// stopWatch.Stop(); -// if (response != null) -// { -// pubnubRequestState.Response = response; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got PubnubWebResponse for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.RequestUri.ToString())); -// using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) -// { -// //Need to return this response -// #if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -// #else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -// #endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// pubnubRequestState.GotJsonResponse = true; -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, SendRequestAndGetJsonResponseTaskFactory => Retrieved JSON", DateTime.Now.ToString(CultureInfo.InvariantCulture))); - -// if (pubnubRequestState.Response != null) -// { -// #if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -// #endif -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } - -// return jsonString; -// } -// } -// else -// { -// return ""; -// } -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// throw; -// } -// return ""; -// } -// catch -// { -// throw; -// } -// } - -// async Task SendRequestAndGetStreamResponseTaskFactory(RequestState pubnubRequestState, HttpWebRequest request) -// { -// HttpWebResponse response = null; -// byte[] streamBytes; -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetStreamResponseTaskFactory", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// try -// { -// request.Method = FindHttpGetOrDeleteMethod(pubnubRequestState); -// var _ = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// response = await Task.Factory.FromAsync(request.BeginGetResponse, asyncPubnubResult => (HttpWebResponse)request.EndGetResponse(asyncPubnubResult), pubnubRequestState).ConfigureAwait(false); -// stopWatch.Stop(); -// pubnubRequestState.Response = response; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got PubnubWebResponse for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.RequestUri.ToString())); -// int statusCode = (int)pubnubRequestState.Response.StatusCode; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, status code = {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), statusCode)); -// using (Stream stream = response.GetResponseStream()) -// { -// long totalSize = 0; -// long receivedSize = 0; -// //Allocate 1K buffer -// byte[] buffer = new byte[1024]; -// using(MemoryStream ms = new MemoryStream()) -// { -//#if NET35 || NET40 -// int bytesRead = stream.Read(buffer, 0, buffer.Length); -//#else -// int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false); -//#endif -// receivedSize += bytesRead; -// while (bytesRead > 0) -// { -// ms.Write(buffer, 0, bytesRead); -// bytesRead = stream.Read(buffer, 0, buffer.Length); -// receivedSize += bytesRead; -// } -// streamBytes = ms.ToArray(); -// } -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, totalsize = {1}; received = {2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), totalSize, receivedSize)); -// //Need to return this response -// pubnubRequestState.GotJsonResponse = true; -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved Stream", DateTime.Now.ToString(CultureInfo.InvariantCulture))); - -// if (pubnubRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } - -// return streamBytes; -// } -// } -// catch (WebException ex) -// { -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// throw; -// } -// return null; -// } -// catch (Exception ex) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Exception in SendRequestAndGetStreamResponseTaskFactory {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex)); -// throw; -// } -// } - -// async Task SendRequestAndGetJsonResponseTaskFactoryWithPOST(RequestState pubnubRequestState, HttpWebRequest request, byte[] postData, string contentType) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before Task.Factory.FromAsync With POST", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// try -// { -// request.Method = "POST"; -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); - -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); - -// request.ContentType = contentType; - -// using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) -// { -//#if NET35 || NET40 -// requestStream.Write(postData, 0, postData.Length); -// requestStream.Flush(); -//#else -// await requestStream.WriteAsync(postData, 0, postData.Length).ConfigureAwait(false); -// await requestStream.FlushAsync().ConfigureAwait(false); -//#endif - -// } - -// WebResponse response = await Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, pubnubRequestState).ConfigureAwait(false); -// stopWatch.Stop(); -// pubnubRequestState.Response = response as HttpWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got PubnubWebResponse With POST for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.RequestUri.ToString())); -// int statusCode = (int)pubnubRequestState.Response.StatusCode; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, statusCode {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), statusCode)); -// if (statusCode == 204 && pubnubRequestState.ResponseType == PNOperationType.PNFileUploadOperation) -// { -// return "{}"; -// } -// else -// { -// using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With POST", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// pubnubRequestState.GotJsonResponse = true; - -// if (pubnubRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } - -// return jsonString; -// } -// } -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With POST from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// throw; -// } -// return ""; -// } -// catch (Exception ex) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Exception in SendRequestAndGetJsonResponseTaskFactoryWithPOST {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), ex)); -// throw; -// } -// } - -// async Task SendRequestAndGetJsonResponseTaskFactoryWithPATCH(RequestState pubnubRequestState, HttpWebRequest request, byte[] patchData, string contentType) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before Task.Factory.FromAsync With PATCH", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// try -// { -// request.Method = "PATCH"; -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); - -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); - -// request.ContentType = "application/json"; - -// using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) -// { -//#if NET35 || NET40 -// requestStream.Write(patchData, 0, patchData.Length); -// requestStream.Flush(); -//#else -// await requestStream.WriteAsync(patchData, 0, patchData.Length).ConfigureAwait(false); -// await requestStream.FlushAsync().ConfigureAwait(false); -//#endif - -// } - -// WebResponse response = await Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, pubnubRequestState).ConfigureAwait(false); -// stopWatch.Stop(); -// pubnubRequestState.Response = response as HttpWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Got PubnubWebResponse With PATCH for {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), request.RequestUri.ToString())); -// using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With PATCH", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// pubnubRequestState.GotJsonResponse = true; - -// if (pubnubRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// pubnubRequestState.Response = null; -// pubnubRequestState.RequestCancellationTokenSource = null; -// } - -// return jsonString; -// } -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With PATCH from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// throw; -// } -// return ""; -// } -// catch -// { -// throw; -// } -// } - -// async Task SendRequestAndGetJsonResponseClassicHttp(Uri requestUri, RequestState pubnubRequestState, HttpWebRequest request) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetJsonResponseClassicHttp", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// var taskComplete = new TaskCompletionSource(); -// try -// { -// request.Method = FindHttpGetOrDeleteMethod(pubnubRequestState); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before BeginGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// request.BeginGetResponse(new AsyncCallback( -// async (asynchronousResult) => { -// RequestState asyncRequestState = asynchronousResult.AsyncState as RequestState; -// HttpWebRequest asyncWebRequest = asyncRequestState.RequestCancellationTokenSource as HttpWebRequest; -// if (asyncWebRequest != null) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before EndGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// HttpWebResponse asyncWebResponse = (HttpWebResponse)asyncWebRequest.EndGetResponse(asynchronousResult); -// stopWatch.Stop(); -// asyncRequestState.Response = asyncWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, After EndGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// using (StreamReader streamReader = new StreamReader(asyncWebResponse.GetResponseStream())) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Inside StreamReader", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// //Need to return this response -// string jsonString = streamReader.ReadToEnd(); -// asyncRequestState.GotJsonResponse = true; - -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, SendRequestAndGetJsonResponseClassicHttp => Retrieved JSON", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// taskComplete.TrySetResult(jsonString); -// } -// if (asyncRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// asyncRequestState.Response = null; -// asyncRequestState.RequestCancellationTokenSource = null; -// } -// } -// } -// ), pubnubRequestState); - -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// return taskComplete.Task.Result; -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// await Task.Factory.StartNew(() => { }).ConfigureAwait(false); -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// taskComplete.TrySetException(ex); -// } -// return ""; -// } -// catch (Exception ex) -// { -// taskComplete.TrySetException(ex); -// return ""; -// } -// } - -// async Task SendRequestAndGetStreamResponseClassicHttp(RequestState pubnubRequestState, HttpWebRequest request) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetStreamResponseClassicHttp", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// var taskComplete = new TaskCompletionSource(); -// try -// { -// request.Method = FindHttpGetOrDeleteMethod(pubnubRequestState); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before BeginGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -// request.BeginGetResponse(new AsyncCallback( -// async (asynchronousResult) => { -// RequestState asyncRequestState = asynchronousResult.AsyncState as RequestState; -// HttpWebRequest asyncWebRequest = asyncRequestState.RequestCancellationTokenSource as HttpWebRequest; -// if (asyncWebRequest != null) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before EndGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// HttpWebResponse asyncWebResponse = (HttpWebResponse)asyncWebRequest.EndGetResponse(asynchronousResult); -// stopWatch.Stop(); -// asyncRequestState.Response = asyncWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, After EndGetResponse", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// using (StreamReader streamReader = new StreamReader(asyncWebResponse.GetResponseStream())) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Inside StreamReader", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// //Need to return this response -// string jsonString = streamReader.ReadToEnd(); -// asyncRequestState.GotJsonResponse = true; - -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, SendRequestAndGetStreamResponseClassicHttp => Retrieved JSON", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// taskComplete.TrySetResult(null); -// } -// if (asyncRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// asyncRequestState.Response = null; -// asyncRequestState.RequestCancellationTokenSource = null; -// } -// } -// } -// ), pubnubRequestState); - -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// return taskComplete.Task.Result; -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// await Task.Factory.StartNew(() => { }).ConfigureAwait(false); -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return null; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// taskComplete.TrySetException(ex); -// } -// return null; -// } -// catch (Exception ex) -// { -// taskComplete.TrySetException(ex); -// return null; -// } -// } - -// async Task SendRequestAndGetJsonResponseClassicHttpWithPOST(RequestState pubnubRequestState, HttpWebRequest request, byte[] postData, string contentType) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetJsonResponseClassicHttpWithPOST", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// var taskComplete = new TaskCompletionSource(); -// try -// { -// request.Method = "POST"; -// request.ContentType = contentType; - -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 -// using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) -// { -// requestStream.Write(postData, 0, postData.Length); -// requestStream.Flush(); -// } -//#else -// using (var requestStream = request.GetRequestStream()) -// { -// requestStream.Write(postData, 0, postData.Length); -// requestStream.Flush(); -// } -//#endif - -// IAsyncResult asyncResult = request.BeginGetResponse(new AsyncCallback( -// async (asynchronousResult) => { -// RequestState asyncRequestState = asynchronousResult.AsyncState as RequestState; -// HttpWebRequest asyncWebRequest = asyncRequestState.RequestCancellationTokenSource as HttpWebRequest; -// if (asyncWebRequest != null) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before EndGetResponse With POST ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// HttpWebResponse asyncWebResponse = (HttpWebResponse)asyncWebRequest.EndGetResponse(asynchronousResult); -// stopWatch.Stop(); -// asyncRequestState.Response = asyncWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, After EndGetResponse With POST ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// using (StreamReader streamReader = new StreamReader(asyncWebResponse.GetResponseStream())) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Inside StreamReader With POST ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// //Need to return this response -// string jsonString = streamReader.ReadToEnd(); -// asyncRequestState.GotJsonResponse = true; - -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With POST ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// taskComplete.TrySetResult(jsonString); -// } -// if (asyncRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// asyncRequestState.Response = null; -// asyncRequestState.RequestCancellationTokenSource = null; -// } - -// } -// } -// ), pubnubRequestState); - -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// return taskComplete.Task.Result; -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// await Task.Factory.StartNew(() => { }).ConfigureAwait(false); -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With POST from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// taskComplete.TrySetException(ex); -// } -// return ""; -// } -// catch (Exception ex) -// { -// taskComplete.TrySetException(ex); -// return ""; -// } -// } - -// async Task SendRequestAndGetJsonResponseClassicHttpWithPATCH(RequestState pubnubRequestState, HttpWebRequest request, byte[] patchData) -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, Inside SendRequestAndGetJsonResponseClassicHttpWithPATCH", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// var taskComplete = new TaskCompletionSource(); -// try -// { -// request.Method = "PATCH"; -// request.ContentType = "application/json"; - -// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); -// stopWatch.Start(); -//#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 -// using (var requestStream = await Task.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, pubnubRequestState).ConfigureAwait(false)) -// { -// requestStream.Write(patchData, 0, patchData.Length); -// requestStream.Flush(); -// } -//#else -// using (var requestStream = request.GetRequestStream()) -// { -// requestStream.Write(patchData, 0, patchData.Length); -// requestStream.Flush(); -// } -//#endif - -// IAsyncResult asyncResult = request.BeginGetResponse(new AsyncCallback( -// async (asynchronousResult) => { -// RequestState asyncRequestState = asynchronousResult.AsyncState as RequestState; -// HttpWebRequest asyncWebRequest = asyncRequestState.RequestCancellationTokenSource as HttpWebRequest; -// if (asyncWebRequest != null) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Before EndGetResponse With PATCH ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// HttpWebResponse asyncWebResponse = (HttpWebResponse)asyncWebRequest.EndGetResponse(asynchronousResult); -// stopWatch.Stop(); -// asyncRequestState.Response = asyncWebResponse; -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, After EndGetResponse With PATCH ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// using (StreamReader streamReader = new StreamReader(asyncWebResponse.GetResponseStream())) -// { -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Inside StreamReader With PATCH ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// //Need to return this response -// string jsonString = streamReader.ReadToEnd(); -// asyncRequestState.GotJsonResponse = true; - -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With PATCH ", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// taskComplete.TrySetResult(jsonString); -// } -// if (asyncRequestState.Response != null) -// { -//#if NET35 || NET40 || NET45 || NET461 || NET48 -// pubnubRequestState.Response.Close(); -//#endif -// asyncRequestState.Response = null; -// asyncRequestState.RequestCancellationTokenSource = null; -// } - -// } -// } -// ), pubnubRequestState); - -// Timer webRequestTimer = new Timer(OnPubnubWebRequestTimeout, pubnubRequestState, GetTimeoutInSecondsForResponseType(pubnubRequestState.ResponseType) * 1000, Timeout.Infinite); -// return taskComplete.Task.Result; -// } -// catch (WebException ex) -// { -// if (ex.Response != null) -// { -// pubnubRequestState.Response = ex.Response as HttpWebResponse; -// using (StreamReader streamReader = new StreamReader(ex.Response.GetResponseStream())) -// { -// //Need to return this response -//#if NET35 || NET40 -// await Task.Factory.StartNew(() => { }).ConfigureAwait(false); -// string jsonString = streamReader.ReadToEnd(); -//#else -// string jsonString = await streamReader.ReadToEndAsync().ConfigureAwait(false); -//#endif -// System.Diagnostics.Debug.WriteLine(jsonString); -// System.Diagnostics.Debug.WriteLine(""); -// System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.InvariantCulture, "DateTime {0}, Retrieved JSON With PATCH from WebException response", DateTime.Now.ToString(CultureInfo.InvariantCulture))); -// return jsonString; -// } -// } - -// if (ex.Message.IndexOf("The request was aborted: The request was canceled", StringComparison.OrdinalIgnoreCase) == -1 -// && ex.Message.IndexOf("Machine suspend mode enabled. No request will be processed.", StringComparison.OrdinalIgnoreCase) == -1) -// { -// taskComplete.TrySetException(ex); -// } -// return ""; -// } -// catch (Exception ex) -// { -// taskComplete.TrySetException(ex); -// return ""; -// } -// } - -// protected void OnPubnubWebRequestTimeout(object state, bool timeout) -// { -// if (timeout && state != null) -// { -// RequestState currentState = state as RequestState; -// if (currentState != null) -// { -// HttpWebRequest request = currentState.RequestCancellationTokenSource; -// if (request != null) -// { -// string currentMultiChannel = (currentState.Channels == null) ? "" : string.Join(",", currentState.Channels.OrderBy(x => x).ToArray()); -// string currentMultiChannelGroup = (currentState.ChannelGroups == null) ? "" : string.Join(",", currentState.ChannelGroups.OrderBy(x => x).ToArray()); -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, OnPubnubWebRequestTimeout: client request timeout reached.Request abort for channel={1} ;channelgroup={2}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentMultiChannel, currentMultiChannelGroup), pubnubConfig.LogVerbosity); -// currentState.Timeout = true; -// try -// { -// request.Abort(); -// } -// catch { /* ignore */ } -// } -// } -// else -// { -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, OnPubnubWebRequestTimeout: client request timeout reached. However state is unknown", DateTime.Now.ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); -// } -// } -// } - -// protected void OnPubnubWebRequestTimeout(System.Object requestState) -// { -// RequestState currentState = requestState as RequestState; -// if (currentState != null && currentState.Response == null && currentState.RequestCancellationTokenSource != null) -// { -// currentState.Timeout = true; -// LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime: {0}, **WP7 OnPubnubWebRequestTimeout** Initiated at {1}", DateTime.Now.ToString(CultureInfo.InvariantCulture), currentState.TimeQueued.GetValueOrDefault().ToString(CultureInfo.InvariantCulture)), pubnubConfig.LogVerbosity); - -// try -// { -// currentState.RequestCancellationTokenSource.Abort(); -// } -// catch { /* ignore */ } - -// if (currentState.ResponseType != PNOperationType.PNSubscribeOperation -// && currentState.ResponseType != PNOperationType.Presence -// && currentState.ResponseType != PNOperationType.PNHeartbeatOperation -// && currentState.ResponseType != PNOperationType.Leave) -// { -// PNStatusCategory errorCategory = PNStatusCategory.PNTimeoutCategory; -// PNStatus status = new StatusBuilder(pubnubConfig, jsonLib).CreateStatusResponse(currentState.ResponseType, errorCategory, currentState, (int)HttpStatusCode.NotFound, new PNException("Request timeout")); - -// if (currentState.Channels != null && currentState.Channels.Length > 0) -// { -// status.AffectedChannels.AddRange(currentState.Channels); -// } - -// if (currentState.ChannelGroups != null && currentState.ChannelGroups.Length > 0) -// { -// status.AffectedChannels.AddRange(currentState.ChannelGroups); -// } - -// if (currentState.PubnubCallback != null) -// { -// currentState.PubnubCallback.OnResponse(default(T), status); -// } -// } -// } -// } - -// protected int GetTimeoutInSecondsForResponseType(PNOperationType type) -// { -// int timeout; -// if (type == PNOperationType.PNSubscribeOperation || type == PNOperationType.Presence) -// { -// timeout = pubnubConfig.SubscribeTimeout; -// } -// else if (type == PNOperationType.PNGenerateFileUploadUrlOperation) -// { -// timeout = pubnubConfig.NonSubscribeRequestTimeout*3; -// } -// else if (type == PNOperationType.PNFileUploadOperation || type == PNOperationType.PNDownloadFileOperation) -// { -// timeout = pubnubConfig.NonSubscribeRequestTimeout * 25; -// } -// else -// { -// timeout = pubnubConfig.NonSubscribeRequestTimeout; -// } -// return timeout; -// } - -// private static string FindHttpGetOrDeleteMethod(RequestState pubnubRequestState) -// { -// return (pubnubRequestState != null && (pubnubRequestState.ResponseType == PNOperationType.PNDeleteMessageOperation -// || pubnubRequestState.ResponseType == PNOperationType.PNDeleteUuidMetadataOperation -// || pubnubRequestState.ResponseType == PNOperationType.PNDeleteChannelMetadataOperation -// || pubnubRequestState.ResponseType == PNOperationType.PNRemoveMessageActionOperation -// || pubnubRequestState.ResponseType == PNOperationType.PNAccessManagerRevokeToken -// || pubnubRequestState.ResponseType == PNOperationType.PNDeleteFileOperation)) ? "DELETE" : "GET"; - -// } -// } -//} diff --git a/src/Api/PubnubApi/PubnubHttpClientHandler.cs b/src/Api/PubnubApi/PubnubHttpClientHandler.cs deleted file mode 100644 index 253e9e004..000000000 --- a/src/Api/PubnubApi/PubnubHttpClientHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10 -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace PubnubApi -{ - public class PubnubHttpClientHandler: DelegatingHandler - { - private readonly PNConfiguration pubnubConfig; - private readonly IPubnubLog pubnubLog; - - private readonly string pubnubHandlerName; - - public PubnubHttpClientHandler(string name, HttpClientHandler innerHandler, PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log) - { - base.InnerHandler = innerHandler; - pubnubHandlerName = string.IsNullOrEmpty(name) ? string.Empty : name; - pubnubConfig = config; - pubnubLog = log; - } - - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - cancellationToken.ThrowIfCancellationRequested(); - LoggingMethod.WriteToLog(pubnubLog, string.Format(CultureInfo.InvariantCulture, "DateTime {0} PubnubHttpClientHandler {1} SendAsync ", DateTime.Now.ToString(CultureInfo.InvariantCulture), pubnubHandlerName), pubnubConfig.LogVerbosity); - return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); - } - } -} -#endif diff --git a/src/Api/PubnubApi/Security/Crypto/Common/Util.cs b/src/Api/PubnubApi/Security/Crypto/Common/Util.cs index 1f43ca580..7a4070a2c 100644 --- a/src/Api/PubnubApi/Security/Crypto/Common/Util.cs +++ b/src/Api/PubnubApi/Security/Crypto/Common/Util.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Security.Cryptography; using System.Text; diff --git a/src/Api/PubnubApi/Transport/HttpClientService.cs b/src/Api/PubnubApi/Transport/HttpClientService.cs index 685e858f4..c448a3a73 100644 --- a/src/Api/PubnubApi/Transport/HttpClientService.cs +++ b/src/Api/PubnubApi/Transport/HttpClientService.cs @@ -2,17 +2,23 @@ using System.Net.Http; using System.Threading.Tasks; using System.Linq; +using System.Net; using System.Text; namespace PubnubApi { public class HttpClientService : IHttpClientService { - private readonly HttpClient _httpClient; - - public HttpClientService() + private readonly HttpClient httpClient; + public HttpClientService(IWebProxy proxy = default) { - _httpClient = new HttpClient(); + httpClient = new HttpClient(); + if (proxy == null) return; + httpClient = new HttpClient(new HttpClientHandler() + { + Proxy = proxy, + UseProxy = true, + }); } public async Task GetRequest(TransportRequest transportRequest) @@ -25,7 +31,7 @@ public async Task GetRequest(TransportRequest transportReques requestMessage.Headers.Add(kvp.Key, kvp.Value); } } - var httpResult = await _httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); + var httpResult = await httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); var responseContent = await httpResult.Content.ReadAsByteArrayAsync().ConfigureAwait(false); response = new TransportResponse() { StatusCode = (int)httpResult.StatusCode, @@ -59,7 +65,7 @@ public async Task PostRequest(TransportRequest transportReque } } HttpRequestMessage requestMessage = new HttpRequestMessage(method: HttpMethod.Post, requestUri: transportRequest.RequestUrl) { Content = postData }; - var httpResult = await _httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); + var httpResult = await httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); var responseContent = await httpResult.Content.ReadAsByteArrayAsync().ConfigureAwait(false); transportResponse= new TransportResponse() { @@ -108,7 +114,7 @@ public async Task PutRequest(TransportRequest transportReques } } - var httpResult = await _httpClient.SendAsync(request: requestMessage, + var httpResult = await httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); var responseContent = await httpResult.Content.ReadAsByteArrayAsync().ConfigureAwait(false); transportResponse = new TransportResponse() @@ -133,20 +139,20 @@ public async Task DeleteRequest(TransportRequest transportReq { TransportResponse response; try { - if (transportRequest.Timeout.HasValue) _httpClient.Timeout = (TimeSpan)transportRequest.Timeout; + if (transportRequest.Timeout.HasValue) httpClient.Timeout = (TimeSpan)transportRequest.Timeout; HttpRequestMessage requestMessage = new HttpRequestMessage(method: HttpMethod.Delete, requestUri: transportRequest.RequestUrl); if (transportRequest.Headers.Keys.Count > 0) { foreach (var kvp in transportRequest.Headers) { requestMessage.Headers.Add(kvp.Key, kvp.Value); } } - var httpResult = await _httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); + var httpResult = await httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); var responseContent = await httpResult.Content.ReadAsByteArrayAsync().ConfigureAwait(false); response = new TransportResponse() { StatusCode = (int)httpResult.StatusCode, Content = responseContent, Headers = httpResult.Headers.ToDictionary(h => h.Key, h => h.Value), - RequestUrl = httpResult.RequestMessage.RequestUri.AbsolutePath + RequestUrl = httpResult.RequestMessage?.RequestUri?.AbsolutePath }; } catch (Exception ex) { response = new TransportResponse() { @@ -189,7 +195,7 @@ public async Task PatchRequest(TransportRequest transportRequ } } - var httpResult = await _httpClient.SendAsync(request: requestMessage, + var httpResult = await httpClient.SendAsync(request: requestMessage, cancellationToken: transportRequest.CancellationToken).ConfigureAwait(false); var responseContent = await httpResult.Content.ReadAsByteArrayAsync().ConfigureAwait(false); transportResponse = new TransportResponse() diff --git a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj index c207f42cc..37b09002d 100644 --- a/src/Api/PubnubApiPCL/PubnubApiPCL.csproj +++ b/src/Api/PubnubApiPCL/PubnubApiPCL.csproj @@ -29,9 +29,6 @@ PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously PubNub 2012-2021 - $(PackageTargetFallback);dnxcore50 - - $(PackageTargetFallback);dnxcore50 @@ -292,9 +289,6 @@ Interface\IJsonPluggableLibrary.cs - - Interface\IPubnubHttp.cs - Interface\IPubnubLog.cs @@ -303,9 +297,6 @@ - - Interface\IUrlRequestBuilder.cs - JsonDataParse\DeserializeToInternalObjectUtility.cs @@ -591,10 +582,6 @@ RetryConfiguration.cs - - PubnubHttp.cs - - Push\Mpns\MpnsCycleTileNotification.cs diff --git a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj index cadc52467..64f033e8a 100644 --- a/src/Api/PubnubApiUWP/PubnubApiUWP.csproj +++ b/src/Api/PubnubApiUWP/PubnubApiUWP.csproj @@ -29,9 +29,6 @@ PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously PubNub 2012-2021 - - - false @@ -408,9 +405,6 @@ Interface\IJsonPluggableLibrary.cs - - Interface\IPubnubHttp.cs - Interface\ISubscribeOperation.cs @@ -421,9 +415,6 @@ Interface\IPubnubUnitTest.cs - - Interface\IUrlRequestBuilder.cs - JsonDataParse\DeserializeToInternalObjectUtility.cs @@ -717,10 +708,6 @@ RetryConfiguration.cs - - PubnubHttp.cs - - Push\Mpns\MpnsCycleTileNotification.cs diff --git a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj index 7997afcf7..f9cde8f5a 100644 --- a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj +++ b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj @@ -29,9 +29,6 @@ PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously PubNub 2012-2021 - $(PackageTargetFallback);dnxcore50 - - $(PackageTargetFallback);dnxcore50 @@ -300,18 +297,12 @@ Interface\IJsonPluggableLibrary.cs - - Interface\IPubnubHttp.cs - Interface\IPubnubLog.cs Interface\IPubnubUnitTest.cs - - Interface\IUrlRequestBuilder.cs - @@ -591,10 +582,6 @@ PubnubCoreBase.cs - - PubnubHttp.cs - - Push\Mpns\MpnsCycleTileNotification.cs