Skip to content

Commit

Permalink
Fix subscribe request timeout (#460)
Browse files Browse the repository at this point in the history
fix(subscribe): fix subscribe request timeout

Fix issue because of which wrong request timeout has been used.

* fix(subscribe): fix user timetoken parse

Fix issue with `PNSubscribeCursorData` which should have an optional `region` to handle user
timetoken in received real-time messages.
  • Loading branch information
parfeon authored Jul 8, 2024
1 parent 538e65c commit 31fdf33
Show file tree
Hide file tree
Showing 23 changed files with 466 additions and 76 deletions.
17 changes: 12 additions & 5 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
---
name: objective-c
scm: github.com/pubnub/objective-c
version: "5.6.0"
version: "5.6.1"
schema: 1
changelog:
- date: 2024-07-08
version: v5.6.1
changes:
- type: bug
text: "Fix issue because of which wrong request timeout has been used."
- type: bug
text: "Fix issue with `PNSubscribeCursorData` which should have an optional `region` to handle user timetoken in received real-time messages."
- date: 2024-06-27
version: v5.6.0
changes:
Expand Down Expand Up @@ -1358,7 +1365,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: PubNub.framework
location: https://github.com/pubnub/objective-c/archive/refs/tags/v5.6.0.zip
location: https://github.com/pubnub/objective-c/archive/refs/tags/v5.6.1.zip
supported-platforms:
supported-operating-systems:
macOS:
Expand Down Expand Up @@ -1419,7 +1426,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: PubNub.ios.xcframework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.0/PubNub.ios.xcframework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.1/PubNub.ios.xcframework.tar.gz
supported-platforms:
supported-operating-systems:
iOS:
Expand All @@ -1438,7 +1445,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: PubNub.macos.framework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.0/PubNub.macos.framework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.1/PubNub.macos.framework.tar.gz
supported-platforms:
supported-operating-systems:
macOS:
Expand All @@ -1454,7 +1461,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: PubNub.tvos.xcframework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.0/PubNub.tvos.xcframework.tar.gz
location: https://github.com/pubnub/objective-c/releases/download/v5.6.1/PubNub.tvos.xcframework.tar.gz
supported-platforms:
supported-operating-systems:
tvOS:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v5.6.1
July 08 2024

#### Fixed
- Fix issue because of which wrong request timeout has been used.
- Fix issue with `PNSubscribeCursorData` which should have an optional `region` to handle user timetoken in received real-time messages.

## v5.6.0
June 27 2024

Expand Down
6 changes: 2 additions & 4 deletions Example/PubNub/PNAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,8 @@ - (void)handleErrorStatus:(PNErrorStatus *)status {
NSLog(@"Decryption error. Be sure the data is encrypted and/or encrypted with the correct cipher key.");
NSLog(@"You can find the raw data returned from the server in the status.data attribute: %@", status.associatedObject);
if (status.operation == PNSubscribeOperation) {

NSLog(@"Decryption failed for message from channel: %@\nmessage: %@",
((PNMessageData *)status.associatedObject).channel,
((PNMessageData *)status.associatedObject).message);
PNSubscribeMessageEventData *data = status.associatedObject;
NSLog(@"Decryption failed for message from channel: %@\nmessage: %@", data.channel, data.message);
}
}
else if (status.category == PNMalformedFilterExpressionCategory) {
Expand Down
6 changes: 3 additions & 3 deletions Framework/PubNub/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>PubNub</string>
<key>CFBundleGetInfoString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleIdentifier</key>
<string>com.pubnub.pubnub-objc</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>NSHumanReadableCopyright</key>
<string>© 2010 - 2020 PubNub, Inc.</string>
<key>NSPrincipalClass</key>
Expand Down
6 changes: 3 additions & 3 deletions Framework/PubNub/PubNub-iOS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>PubNub</string>
<key>CFBundleGetInfoString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleIdentifier</key>
<string>com.pubnub.pubnub-objc</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>NSHumanReadableCopyright</key>
<string>© 2010 - 2020 PubNub, Inc.</string>
<key>NSPrincipalClass</key>
Expand Down
6 changes: 3 additions & 3 deletions Framework/PubNub/PubNub-tvOS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>PubNub</string>
<key>CFBundleGetInfoString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleIdentifier</key>
<string>com.pubnub.pubnub-objc</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>NSHumanReadableCopyright</key>
<string>© 2010 - 2020 PubNub, Inc.</string>
<key>NSPrincipalClass</key>
Expand Down
6 changes: 3 additions & 3 deletions Framework/PubNub/PubNub-watchOS-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>PubNub</string>
<key>CFBundleGetInfoString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleIdentifier</key>
<string>com.pubnub.pubnub-objc</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>5.6.0</string>
<string>5.6.1</string>
<key>NSHumanReadableCopyright</key>
<string>© 2010 - 2020 PubNub, Inc.</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion PubNub.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |spec|
spec.name = 'PubNub'
spec.version = '5.6.0'
spec.version = '5.6.1'
spec.summary = 'The PubNub Real-Time Network. Build real-time apps quickly and scale them globally.'
spec.homepage = 'https://github.com/pubnub/objective-c'

Expand Down
14 changes: 7 additions & 7 deletions PubNub/Data/Managers/PNSubscriber.m
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ - (void)handleNewMessage:(PNMessageResult *)message {

PNErrorStatus *status = nil;

PNLogResult(self.client.logger, @"<PubNub> %@", [message stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [message stringifiedRepresentationWithSerializer:self.client.coder]);

if (message.data.decryptionError) {
status = [PNErrorStatus objectWithOperation:PNSubscribeOperation
Expand All @@ -1352,23 +1352,23 @@ - (void)handleNewMessage:(PNMessageResult *)message {
- (void)handleNewSignal:(PNSignalResult *)signal {
if (!signal) return;

PNLogResult(self.client.logger, @"<PubNub> %@", [signal stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [signal stringifiedRepresentationWithSerializer:self.client.coder]);

[self.client.listenersManager notifySignal:signal];
}

- (void)handleNewMessageAction:(PNMessageActionResult *)action {
if (!action) return;

PNLogResult(self.client.logger, @"<PubNub> %@", [action stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [action stringifiedRepresentationWithSerializer:self.client.coder]);

[self.client.listenersManager notifyMessageAction:action];
}

- (void)handleNewObjectsEvent:(PNObjectEventResult *)object {
if (!object) return;

PNLogResult(self.client.logger, @"<PubNub> %@", [object stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [object stringifiedRepresentationWithSerializer:self.client.coder]);

[self.client.listenersManager notifyObjectEvent:object];
}
Expand All @@ -1377,8 +1377,8 @@ - (void)handleNewFileEvent:(PNFileEventResult *)file {
PNErrorStatus *status = nil;

if (file) {
PNLogResult(self.client.logger, @"<PubNub> %@", [file stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [file stringifiedRepresentationWithSerializer:self.client.coder]);

if (file.data.decryptionError) {
status = [PNErrorStatus objectWithOperation:PNSubscribeOperation
category:PNDecryptionErrorCategory
Expand All @@ -1398,7 +1398,7 @@ - (void)handleNewFileEvent:(PNFileEventResult *)file {

- (void)handleNewPresenceEvent:(PNPresenceEventResult *)presence {
if (presence) {
PNLogResult(self.client.logger, @"<PubNub> %@", [presence stringifiedRepresentationWithSerializer:nil]);
PNLogResult(self.client.logger, @"<PubNub> %@", [presence stringifiedRepresentationWithSerializer:self.client.coder]);
}

[self.client.listenersManager notifyPresenceEvent:presence];
Expand Down
4 changes: 2 additions & 2 deletions PubNub/Data/Service Objects/PNOperationResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (id)copyWithZone:(NSZone *)zone {
- (NSDictionary *)dictionaryRepresentationWithSerializer:(id<PNObjectSerializer>)serializer {
id processedData = self.responseData;

if (serializer) {
if (serializer && processedData) {
NSError *err;
NSData *serializedData = [serializer dataOfClass:[NSDictionary class] fromObject:processedData withError:&err];
NSDictionary *serializedDictionary = [serializer.jsonSerializer JSONObjectWithData:serializedData error:&err];
Expand All @@ -128,7 +128,7 @@ - (NSDictionary *)dictionaryRepresentationWithSerializer:(id<PNObjectSerializer>
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSMutableDictionary *response = [@{
@"Status code": @(self.statusCode),
@"Processed data": processedData
@"Processed data": processedData ?: @"no data"
} mutableCopy];

return @{@"Operation": PNOperationTypeStrings[self.operation],
Expand Down
2 changes: 1 addition & 1 deletion PubNub/Misc/PNConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma mark General information constants

// Stores client library version number
static NSString * const kPNLibraryVersion = @"5.6.0";
static NSString * const kPNLibraryVersion = @"5.6.1";

// Stores information about SDK codebase
static NSString * const kPNCommit = @"fd5c7ed678527fce07eaf7eb162935caf1bfd303";
Expand Down
Loading

0 comments on commit 31fdf33

Please sign in to comment.