Comments (13)
How this affects me:
I am trying to fetch full history in a channel by making multiple calls to the history API. When each history response is received i make another history request with the start date from the previous response.
Now due to this error, my history fetch is looses integrity.
from objective-c.
Those precision is redundant for NSDate, thats why value vas transformed into normal seconds (there is 10^7 extra length which is not even unix timestamp)
from objective-c.
@rakeshta alternatively, cant you use:
+ (void)requestFullHistoryForChannel:(PNChannel *)channel;
+ (void)requestFullHistoryForChannel:(PNChannel *)channel
withCompletionBlock:(PNClientHistoryLoadHandlingBlock)handleBlock;
To pull full history?
from objective-c.
But @rakeshta is correct about that raw time token for corresponding objects is required.
from objective-c.
@geremyCohen requestFullHistoryForChannel:
will only fetch the 100 most recent messages. Apparently this is a limit in your REST API. (I verified this by invoking your API without the limit query param.)
So to fetch full history, I have to make multiple history requests using the date range from the previous history result as the input for the next query. (This is exactly how the dev console on your website does it)
from objective-c.
@parfeon perhaps NSDate
is not the right data structure to pass these time tokens around? (You could have your own PNTime
or something)
from objective-c.
Here's the fix:
PNMacro.h
Replace line 157
- timeStamp = longLongValue/10000000;
with
+ timeStamp = (NSTimeInterval)longLongValue/10000000;
static NSTimeInterval PNUnixTimeStampFromTimeToken(NSNumber *timeToken);
NSTimeInterval PNUnixTimeStampFromTimeToken(NSNumber *timeToken) {
unsigned long long int longLongValue = [timeToken unsignedLongLongValue];
NSTimeInterval timeStamp = longLongValue;
if (longLongValue > INT32_MAX) {
timeStamp = (NSTimeInterval)longLongValue/10000000;
}
return timeStamp;
}
from objective-c.
There's still a minute accuracy error when converting between unsigned long long int
and NSTimeInterval
. But its way better than when all sub second information was getting lost.
from objective-c.
Thanks @rakeshta ! We'll review this and queue it for master merge.
from objective-c.
Hi @rakeshta
I modified PubNub sources and added custom date object (as you suggested it is PNDate) and it has two methods: date (which will return NSDate) and timeToken (which will return NSNumber with unsigned long long integer in it as number arrived in response)
from objective-c.
@parfeon; That is awesome. thanks!
from objective-c.
@parfeon, thanks for the quick action! and @rakeshta, thanks for helping us make the client even better!
from objective-c.
@rakeshta if you can clone local, and merge master into this branch for now, I will be merging it into master by end of week for production use.
from objective-c.
Related Issues (20)
- Crash using library : [__NSMallocBlock__ handleClientConnectionStateChange:]: unrecognized selector sent to instance 0x17044e460 HOT 3
- Decryption error HOT 1
- Can't disable logger HOT 6
- Crash: EXC_CRASH (SIGSEGV) SIGNAL 11 Segmentation fault: 11
- 3.6.2 Released!
- requestHistoryForChannel: callback never called HOT 4
- When is the mentioned update for aps / APNs handling going to come out? HOT 6
- PubNub Crashes upon subscription HOT 4
- 3.6.3 Released!
- Retrieve Channel History HOT 2
- TableLoad before Request History HOT 3
- Multiple channel subscriptions with different cipher, subscribe, and auth keys HOT 1
- Python - publishing to APNS HOT 1
- Has any one got this working with swift and cocoapods? HOT 2
- Several crashes in 3.7.10.4 HOT 6
- PNJSONSerialization replacing NSNull characters during serialization prevents proper deserialization HOT 1
- PNImports.h file not found HOT 10
- Can't update sdk from COcoa pods any more HOT 4
- Does character ":" (colon) has special meaning in the channel name? HOT 5
- Cannot use the library in an app extension. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objective-c.