how can i make socket connection run in the background process for android and ios in react native? - react-native

I have tried to run socket connection in the background process for android and ios, to display notifications using notifee package, what I'm trying to do is when the app is killed the service is going to still run in background process and display notification when the app is killed.

Related

Receive messages in the background state from a STOMP client socket in React Native

Previously, I had been using Xcode 13 to receive socket messages in the background state on iOS 15.5, and it was working perfectly. However, when I tried the same approach on iOS 16.2, the messages were not being received. I then updated to Xcode 14, but I'm still not getting any messages in either iOS version. Is there a way to receive messages in the background state from a socket in iOS 15.5 and 16.2?
I checked the socket is not disconnected in background state.

How to keep socket open when a react native app is in background?

Is there any way to keep the same socket open when the app is running in the background? The connection gets disconnected a few seconds after stepping out of the app like going to the home screen.
I'm using Socket.io btw.
Thanks.

MobileFirst heartbeat call in background with screen lock

Inside WLClient.h mention this comment.
#note The client sends a heartbeat signal to the server only when
the application is in the foreground. When the application is sent to
the background, the client stops sending heartbeat signals. The client
resumes sending heartbeat signals when the application is brought to
the foreground again.
I set my setHeartBeatInterval to 420. which is default. But when the app goes into background with lock screen. It still will call the heartbeat after 420 seconds. Then my app crash.
Is there anyway to disable the heartbeat call when the app goes into background?
Thanks so much =)
On MFP 7.1, we are not seeing any issue with heartbeat in both iOS 9.3.5 and iOS 10. In both iOS versions, when the app is in background(by pressing home or behind the lock screen), the heartbeats are paused and are not sent.
We see this behavior in the latest v7.1 iFix version and on iOS devices running iOS9.3.5 and iOS10.
However, on iOS10 simulator, we can see couple of heartbeat requests are made when the screen is locked or if the home button is pressed. But, even here, when the app is resumed, there is no crash. This seems to be a behavior with iOS 10 simulator only.

Keep react-native application alive on android

I work on a mobile application and use MQTT (javascript paho client) for push notification. But after user or android close application ,MQTT socket has been disconnected and cannot receive notifications. So, I need to make a service to keep socket alive. How can I make a service by react-native?
I am using react-native-background-job for a similar use case. This library allows you to run a background job that will run periodically, but for this use case the important feature is that if you pass a alwaysRunning parameter when scheduling the job, the app will keep running in the background even if the user closes it.

Mac to iPhone App Communication over WiFi

I am new to developing for the iPhone and would love some advice on an app i'm trying to develop.
Is it possible to send commands to an app on iOS 3.2 from OS X using AppleScript. The iOS app will display an image and run a small script when it recieves the appropriate command from the client software running on a Mac Mini. The devices would communicate over an a closed WiFi network.
Before I continue down this path does anyone have any advice on how to setup the communication (i.e. get the app to run in the background and listen on a designated port).
I don't know the full process but I know that various apps do this one way or another, such as 1password and desktop remote mouse apps. I think that CocoaAsyncSocket will help. An alternative to having the iOS app listening on a socket is to open a connection from iOS to OS X and then persist it. You can then send data either way through the connection.