I have implemented chatting application using XMPP iOS Framework with OpenFire server.
Fortunately, application is running successfully but I am facing one issue of internet disconnection in application.
When user is getting logout or went in offline mode manually then it sends stanza to his/her rosters. So his/her rosters knows that user went in offline mode.
Now when internet will disconnect from user's device at that time application is not able to send presence stanza to server due to internet disconnection. So his/her rosters won't get information about that offline user and user will be shown in online mode only.
I thought something like OpenFire server might be able to check connected users and whenever any user gets disconnected it should send presence stanza with offline status to his rosters so they can know that this user is on offline mode.
Can anybody please help me if there is any way through which I can implement this feature.
It will be very helpful for me to solve this issue.
Thanks in advance.
It's the core xmpp feature and Openfire must send unavailable to your contacts on your behalf. So it looks like a bug.
But there is a different problem - users with mobile internet may reconnect too often, and XMPP community developed a Stream Management extension, which allow server to "hibernate" client session when it quickly reconnect and restore it without presence changes. Summarize:
Check if Stream Management is active - in this case user will still online fixed amount of time (typically 5 minutes) and then go offline.
Check if Openfire implements any non-standard extension to maintain user session.
If you are sure none of extensions are "hibernating" user session - then it is a really bug. Try the same with different xmpp server - good candidates are ejabberd and prosody
Related
I am creating a chat application with Node.JS's Socket.IO and there is a couple things I need clarification on.
I am implementing offline messaging in my app meaning that when a user opens the app he will receive all the messages he missed when they were online.
This is my approach:
1) Client opens the app and is subscribed/joins a room
2) The client sends a message to Socket.IO
3) Socket.IO inserts the message in some kind of database/datastore
4) When client tries to retrieve the messages it is pulled from the database/datastore and saved on the users phone then it is deleted from the database.
Is this a correct approach?
I was looking at online and some people suggested using task/message queues like Google App Engines Task Queue but I am not sure how this works.
Your approach sounds OK, but I wouldn't delete messages from a DB, at least not immediately after the client receives them.
From your question it seems that you're not currently saving the messages to a database.
This approach has some drawbacks; for example, the user can't view their chat history on a device that was not connected when some of the messages were sent.
There are 2 ways I can think of to do it in a more elegant manner:
Save all messages to DB. on websocket connection and reconnections, fetch all messages newer than your latest message (This approach assumes no edit functionality in your chat, as edits will not be fetched this way). The latter can be implemented using either HTTP or WebSockets.
If you don't want to store the messages in your server, then you should implement some sort of persistent cache in the device used to send the messages. This is very similar to your original solution, except that instead of storing the messages in a database, you're storing them on the user's device. this does require some logic to detect when messages are received, and when the recipient reconnects, in order to trigger sending the missing messages.
The first approach is much better for the general use case in my opinion, but it depends on your use case.
I'm currently researching about how to make an iOS VoIP app and I wondering how user1 of Skype, Viber, Facebook Messengers... can reach to other user in contact list? In my case, the users can request a call to admins. Then admins can call back to them with their IP address they were request to server.
The big problem is if users connected to a Wi-Fi to request a call to server, app will send their ip address to admins. But if they have to connected to another Wi-Fi, their IP address will difference with the older.
I don't know how to check when user's IP was changed. And how to update the IP if it occurs. Does anyone faced this problem and can you guys give me some solution about this problem?
For this you have to configure many things.
Usually Skype, Viber, Facebook Messengers configure things like below.
Ideally there should be target on specific IP or something.
That end point to get connect in video call has to configured and come from server end
https://www.vidyo.com/ is really good platform, though have SDK in C++ so in any technology you can configure it easily
To know online / offline user's, better approach is websocket
list of user will also based on websocket or API response
Good platform for websocket - https://github.com/tidwall/SwiftWebSocket
Pushkit is also required thing, when app is in killed ( Terminated ) state then using pushkit silent notification with local notification you can notify user about incoming call
I am developing an app that requires the user to be able to request a server and get back some JSON Data. Here are my question and my reasoning behind it:
1) Would this require the user to have "Data" on their cell phone plan?
Dealing with Android, I have figured out that when I do not have "Data" on my cellphone plan, that I can not access the internet, but I am allowed to use twitter. Instagram, however does not load when I do not have "Data".
When I do have Data on my cellphone plan, I am allowed to go onto the internet, use twitter, and use Instagram.
Will my App act as twitter or Instagram in this case? and how do I make the app work without a Data plan?
If your app needs to access the Internet (which is does to reach the server) then the user must either be connected via WiFi or if connected via cellular, the user must have a data plan.
A cellular connection with no data plan will prevent your app from accessing the Internet.
You need to have some sort of connection to the Internet to be able to access the internet.
You don't need a data plan, if your device is connected over wifi (such as iPod touches) then that will allow a connection to the internet.
The apps you mention do run on a device without an internet connection because they handle the case where there is not an internet connection sensibly, and although they load, they don't crash because of a lack of connection.
If you want to do the same thing, then you need to have a way of handling this too.
i am working on an App that uses wifi network to pass data from one ipad to another ipads .
i have already referred the following sample code about:
http://mobileorchard.com/tutorial-networking-and-bonjour-on-ip
The above sample code connects Devices using wifi and can exchange messages using Cfnetworking and Bonjour.
My problem is that i am not able to see Active Servers all the time .While Some times it Shows me Active servers and i can easily connect with and Exchange Messages but when i relaunch or open the app after some time it doesn't show me active servers so i am unable to connect and exchange messages. The same problem occurs in the sample code available from above link having tutorial on to Send data over wifi to another Devices.
I am Stucked up over here where i am unable to connect with active Devices all the time because not able to access those servers.
In chatty sample code same problem occurs where you can see active chat room's and connect with but some times you will not be able to see those active chat rooms availabe even if there are active servers who have already started new chat room where all Devices are connected to same wifi network.
Any help would be highly Appreciable , Thanks in advance.
Any chance the wi-fi interface on the device is going to sleep from disuse? Or that the user roamed to a different Wi-Fi access point with the same name that isn't bridged via Bonjour?
Have you considered using Multipeer Connectivity instead of using Bonjour directly? IIRC, that API would let you communicate even if the devices are not on the same Wi-Fi network, which is probably what you want anyway.
I'm writing an xmpp ios chat app which connects with an openfire server.
The app needs to be able to download all the messages that were missed by the user while the app was closed. So I will need a way to save the missed messages sent on the server, does anyone know a good way to do this? Is there a plugin for something like this, or would this require a custom plugin or something else?
Openfire, like most other XMPP servers, already stores the messages sent by users, when the receiving bare JID was offline, so that it can send those message to the client when it (re-)connects.
See also:
XEP-0160 - Best Practices for Handling Offline Messages
XEP-0013 - Flexible Offline Message Retrieval (supported by Openfire)