Comments (7)
There was definitely an issue with an older build because some idiot (ahem me) left the staging server details in and the real ones commented out. This was fixed two days ago here.
It looks like in your first snippet you are assigning the client directly to your instance variable; the client returned from [PTPusher pusherWithKey] is auto-released - are you forgetting to retain it?
from libpusher.
You are correct, I am assigning the client to an instance variable. I am, however, using ARC, so there shouldn't be a worry in regards to the lack of retain
. However, for safe measure, I just now changed it up so that those were @property (strong)
, and that did not seem to change the outcome.
You don't think that me using ARC has something to do with this, do you? I was under the impression that since you compiled your code as a library, then you could use ARC (or not) independent of if my projected used it...
from libpusher.
No, you're quite right, I forgot about ARC so I'm used to seeing potential memory issues where there wouldn't be with ARC.
One thing to test whether or not a connection is getting through to Pusher is to load up the debug console on the Pusher admin interface for your app ID and see if anything appears when you run your app.
Out of interest, could you try implementing – pusher:connectionDidDisconnect:
as well?
from libpusher.
I added the additional event handler, and that isn't called either :-S
I checked the Pusher website, and it shows 0 connections. So, I don't think it's even making it that far.
Stepping back and looking at the code base a whole, I realized that I am actually setting up my Pusher connection in a GCD thread. Temporarily removing that dispatch_async
block and just running that in the UI thread causes libPusher to fire it's connectionDidConnect
event.
To tell you the truth this was entirely unexpected. Is there a reason this would need to be performed in the UI thread?
from libpusher.
As things stand, the underlying socket relies in the run loop. This makes behaviour on a background thread unpredictable as it depends on what state the run loop is in on the background thread.
libPusher is designed to run on the main thread as the socket communication is asynchronous and doesn't need threading.
from libpusher.
I'll try and update the documentation to make this clear. This might change in the future as CocoaAsyncSocket also has a GCD implementation but I haven't had a chance to see how it compares to the run loop version.
from libpusher.
Thank you very much for your time, and explaining what's going on. Knowing these facts I was able to refactor my code in such a way as to call performSelectorOnMainThread
right when I'm ready to connect to Pusher.
This solves my problem of connecting to pusher, while still allowing the heavy lifting that my app requires prior to connecting to occur outside of the UI thread.
Thank you again, I couldn't have unraveled all of that without your assistance!
from libpusher.
Related Issues (20)
- 'PTEventListener.h' file not found HOT 2
- No auth data sent in subscription event HOT 4
- Crash with PTNSJSONParser objectFromJSONString HOT 2
- [push notifications] Error callbacks? HOT 3
- Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_PTPusher" HOT 1
- [Critical] Version Preprocessor Macro Crashes Cocoapods HOT 1
- Push lib crashes HOT 3
- Retain cycle in PTURLRequestOperation HOT 2
- ReactiveCocoa => ReactiveObjC for swift3
- Undefined symbols for architecture arm64 HOT 2
- Dynamic Channels HOT 4
- New release? HOT 4
- No current subscription to channel myChannel, or subscription in progress HOT 7
- Unable to read your certificate: failed to parse PKCS1 private key HOT 12
- Xcode 9 - PTPusherErrorDomain error while subscribing to private channel HOT 2
- Getting this error. "Value of type 'PTPusherPrivateChannel' has no member 'bind'" HOT 2
- 'WebSocketClient' is ambiguous for type lookup in this context
- Private channel not receiving pusher events. HOT 9
- add objective c documentation for Beam integration HOT 1
- WebSocket Compression 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 libpusher.