MegaBits / SIOSocket

Realtime iOS application framework (client) http://socket.io
MIT License
494 stars 80 forks source link

app goes to background working on simulator but not on device #54

Open josefrm opened 9 years ago

josefrm commented 9 years ago

Hello there,

I have an issue is when im testing the app in simulator, let me explain whats happening

When my app start´s I call a NSObject that handle my connection, and it's a shared object (static), so it handle all my connection thru all views.

Got a protocol to determinate when a message comes in then dispatch to the active view (subscribed one).

When I'm in simulator and minimize the App the application still connected to socket, and receive messages etc.. but when my app run into device it lost the connection (not showing message of disconnected) but simply cannot receive messages.

Any idea whats happening?

Thanks in advance.

pblondin commented 9 years ago

iOS will close your socket connection when the app is running in background mode. You should gracefully close the connection when it enters the background (via AppDelegate) and then reconnect the socket whe the app comes back into the foreground.

josefrm commented 9 years ago

Yeah @pblondin, thats what happening in Device but not in Simulator, anyways I'm going to improve this with push notifications on server side., not what I want but have no choise.

Thanks for reply, regards.

pblondin commented 9 years ago

An hybrid solution with push notifications and socket.io communications is the way to go! Good luck on your project.