Comments (7)
Thanks for reporting this @netgfx. I haven't encountered this issue before now. I would like to reproduce it. Does this crash happen in the simulator, on the device, or both? Are you running Xcode 7.3.1?
from swiftwebsocket.
Yes using xcode 7.3.1 and iOS device (only happens on device) 9.3.2/9.3.1
Over wifi or cellular. Socket is open and receiving messages from python but App is on background.
The inactivity must be over 15' - 20'
The line reported by the debugger is this:
return pthread_cond_timedwait(&self.cond, &self.mutex, &ts)
from swiftwebsocket.
I haven't been able to reproduce this crash yet.
What I've tried was I created a simple app that loads a websocket from viewDidLoad, and receives small messages (around 50 bytes) 5 times a second and print these messages to the Xcode console.
After about 10 seconds I send the app to the background by pressing the Home button. The app receives few more messages (around 5) and prints these to the console. After a few minutes my iphone goes to sleep. I wait about 30 minutes then I awaken the device and bring the app to the foreground. The websocket immediately receives the event Network(The operation couldn’t be completed. Socket is not connected)
. But there isn't a crash.
from swiftwebsocket.
Interesting, the thing is this crash doesn't appear consistently but it appears. So I don't have an exact reproduction route. In my app I have a socket that opens on a wss:// protocol server, and subscribes to a thread (room). Then the app goes to the background and after X-amount of time it is brought back to foreground and then it sometimes crashes.
I have to add that I have never experienced this when the device is connected to the Mac OS via cable. It only happened when the device is not connected via cable.
from swiftwebsocket.
That's helpful info. Couple more questions if you don't mind. Are you creating the websocket from the UI thread? Does this happen in debug or release? And do you have any background modes set in the Info.plist file?
from swiftwebsocket.
- The socket creation is indeed created on the main thread.
- This is happening mostly on release
- Not sure what background modes are, so I presume I don't have anything declared there.
from swiftwebsocket.
Hi Michael.
I'm sorry for responding after so long.
I'm going to close the issue for now because there's been a few updates to the project since this issue has first opened. But if this is still a problem please feel free to reopen the issue or create a new one.
Thanks for supporting the project.
from swiftwebsocket.
Related Issues (20)
- Substring Method Deprecated -- WebSocket.Swift
- the library is very slow
- Abnormal Closure
- How to subscribe and listen to events? HOT 1
- cannot connect with a server HOT 1
- Support Swift 4.2 on CocoaPod HOT 3
- signal SIGPIPE on device
- Swift 5.0 compile error. HOT 9
- Type 'RunLoop' has no member 'Mode' HOT 5
- Compile warning In XCode 10.2.1 with swift 5
- Take Responsibility of this project. HOT 1
- Memory Usage when sending a large message HOT 4
- WebSocketError.needMoreInput
- How do I get the HTTP response headers?
- Doesn't compile on Xcode 11.3.1 HOT 2
- 'NSObject.hashValue' is not overridable; did you mean to override 'NSObject.hash'?
- The "Autobahn Test" link doesn't work...
- Data race
- Send pongs and receive ping events. HOT 1
- Initialization of 'UnsafePointer<UInt8>' results in a dangling pointer
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 swiftwebsocket.