Call server in background - ios4

I'm building an iPhone-app in which the logged in users can chat to each other. It's very like the Wordfeud chat for example. You click a user and a modal view controller shows up where you chat.
I have set up a push notification server that works, I just need to know just how I should use it.
When the chat view controller is open I poll in the background with ASIHttpRequest every tenth second to see if a message has been sent from the user you chat with. This works perfectly fine.
But what happends when i close the chat view controller to do something else in the app. Should I create a ASIHttpRequest in every single view controller in the app to poll for new messages or is it here the push notification service takes over? Even though the app is still open?
Or shouldn't I send push notifications when the app is running, only when it's not running?
If that's the case I guess I have to send a request to the server which says that the app is has now been closed (here is a problem if the app crashed out of the blue).
I would be really greatful for some guidelines here, I have searched the web but there are old discussions which confuses me, and some new ones where many people says different.

Related

No XEP-0333 Chat Markers in XMMPP Openfire backend - how to solve it?

We have an Openfire XMPP/Jabber server setup (with a NodeJs backend and React frontend).
Chat is a feature embedded in the app (NOT an overlay or window that is always visible). So the user has to navigate to a specific page to access the chat interface.
It is working via websockets and messaging sending is working fine. We have a React frontend.
The challenge is that XEP-0333 Chat Markers is not supported by Openfire (the spec never become production ready).
Therefore we need to know how can we implement this feature so that :
A users knows when they are online that they have an unread message (and later, how many unread message they have). For example, if they are not in the chat window and messages are arriving, we need to indicate that in the header of the app so they see it)
if a user goes offline, and comes back online but NOT into the chat window, how can we know if they have unread messages and notify them of that?
My understanding is that somehow we have to keep track of unread messages (eg perhaps in indexedb or local storage or even in postgres backend) and after the user reads a message, we delete it from storage. If the storage still has records for that user then clearly those are the unread messages.
Obviously we don't know if they actually READ the message, but we can assume that if the chat window is open and visible (ie. active tab in their browser) that any messages delivered have been read.
So if our application tab is active, but user is not in chat, and a message arrives, we store it. When they open chat and click on the sender, we remove it from storage.
Has anyone solved it this way? (looking for links to React or JS/TS code)
Is there a better way? (links to other solutions would be helpful, esp. code)

ms teams custom app starting a chat session with a bot

I'm building a teams app that contains some tabs and a bot.
Is it possible to, when an action is performed on a tab (i.e. clicking a button), initialize automatically a chat with the bot, or send a specific message?
Tks
Based on the comments above, what you're looking to do is implement "pro-active" messaging, where the bot itself initiates the conversation. It's definitely possible, and you can read more to get started here and here. The most important thing to know is that your user has to have installed the bot already, to get a "conversation context", but if they've installed the app, which includes the bot, to get the tab, then you're fine. You need to get some variables when they do install the app, which you hook into the conversationUpdate event to get access to. Give it a go and let me know if you have specific questions, here on SOverflow.

Using socket.io to send data to a specific view/id

I have a web application using NodeJS, Express, and MongoDB. In my application, I have a view, that can be seen by anyone who accesses the application. That view is rendered with a different image, depending on which a user selects to view (they do not need to be logged in) ie the view is mapView/mapId.
Now, I want something similar to notifications to occur in realtime for those that are on that page. When a specific event happens from an external source, I want to display a popup on the view to which the event belongs to. So the event may only belong to one mapView/mapId and not another mapView with a different ID. All users on the same mapView/mapId should see the notification. Remember, these are general users that do not need to be logged in.
I am researching into Socket.io because I know it is for making realtime applications. But I am wondering if this is even the right way to go. How will I send data to the correct mapView/mapId?
Check out what your server can do with rooms
The idea is that each of your connections, from a particular view, is joined to a room. Then you use socket.io from the server to send a message only to that room. And only those sockets will get the message.

Xamarin Push Notification, Handling the remote notification once the app becomes active

I know how to send notifications to my iOS devices through PushSharp. However, once I do and the app is inactive, I am looking to find a way to handle the push notification once the app becomes active again.
In other words, I want to be able to see what item they clicked on and be able to show data relevant to that.
Here is a link for reference, it does what I am asking for, but only when the app is active.
http://roycornelissen.wordpress.com/2011/05/12/push-notifications-in-ios-with-monotouch/
Whats the problem?
You have two scenarions:
Push-notification received when app is not launching. If use tap on notification, app will get data in FinishedLaunching handler;
Push-notification received when app is launching. App will get data in ReceivedRemoteNotification handler.
Article in your question shows that processNotification is the same in both scenarios. It shows how to read alert (text)/badge (count)/sound fields and your own custom payload.

JSF+AJAX push : realtime chat / notification system

I'm trying to add some features to my webapp, something like a "live user-to-user" chat (like Facebook's one) and a realtime notifications system.
Let's consider this scenario :
We've got two users, A and B.
A sends a message to B.
If the chat window between B and A is opened on B's browser, we update it, showing the new message on B's browser.
If the windows's not opened, we need to show a notification or something on B's browser.
So, having a PrimeFaces Dialog as the chat window and a PrimeFaces NotificationBar to show notifications, how can I do that?
I can't use PrimeFaces' push as they don't work with Glassfish.
I've found out about ICEPush, that seems to be a nice way to do this, but the thing about "Rendering groups" stopped me from trying it.
How can I update just a SINGLE client if ICEPush talks about groups?
Should I create a new group for each client?
Something like :
B has a "BwithA" group that is updated when A sends a message to B and the chat is opened, and a "notificationsB" group that is updated when the chat windows is closed?
I can't find out how to do that because, even using groups this way, is A that has to tell B that he needs to update, and A doesn't know if B has to update the dialog or the notificationBar !
I hope that the question is clear, because it's not easy to explain it|
Thanks in advance :)
I don't know how a professional Java programmer would solve your problem, but when I wanted to create a chat, I used standard Primefaces Remote Command component and call-back parameters to create chat and send new messages to user's from the server.
There is a p:remoteCommand component on web-page. The purpose of the component is to get the latest messages from a particular user when action listener is invoked. New messages are passed from the server to javascript function (handler of oncomplete event of the component) via "call-back parameters". The function then checks if there are any messages and appends them to the chat box.
For more information, see How to create JSF chat with AJAX
UPD: the solution above is outdated. Now I would use JAX-RS web-services or web sockets to implement chat. There is also a commercial solutions for real-time data streaming: PubNub, Pusher, etc.

Resources