How to get live scores through a plugin for openfire? - ios

I want to create a new plugin which will send live scores to the xmpp iOS client.
I have already created a new plugin and a service for it, but not getting any idea how to send live scores from openfire server to the xmpp iOS client.
Pls, suggest me something.
Thanks

One way would be to use multi chat. You can create a room for each match. Anyone who wishes to receive live score (or anything for that matter) joins the room. You have a bot that sends the score into the room and everybody who is in the room gets it. You can also configure the room so that it is visitors only and anonymous. See XEP-0045
Another way is the use pubsub. Again every match is a node. Users subscribe to the node. See XEP-0060
I'm not sure about others XMPP servers but IFAIK MUC and pubsub are supported by openfire.

Related

Mobile Chat application on Google App Engine and Socket.IO

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.

Ejabberd 16.09 Muc Discovery

We're using IOS XMPP Framework and Android Smack Library to connect our ejabberd server in our mobile application.
Both of them has the similar problem.
When we create the room as admin, we add users to member list by sending ejabberd
<item affiliation='member' jid='xxx#yyy.com'>
Then users can send and receive messages to group without any problem.
And if a user removes the app from device and reinstall it, we are using muc discovery protocol to discover which rooms he/she were joined before he/she uninstall the app
However there is a problem at this point, If a user uses the muc discovery when all the participants of the group became offline. Server doesn't return muc discovery result about that group to user as he/she is a participant of it.
And when I check the admin console those groups seems to have 0 participants(Because all the participants are offline, but they are in the memberlist). And I think muc discovery returns only the groups which have more than 0 participants
Does anyone know why does it happen and how can I find a solution to that? #badlop
We're using ejabberd 16.09
Muc says if user goes offline then he should left all his group, that is why you are not getting group participant when users goes offline.
See here
http://xmpp.org/extensions/xep-0045.html
Instead of using muc use muc-light
https://xmpp.org/extensions/inbox/muc-light.html
It will help you resolve issue and its very easy to implement.

How to use the comment update service in iOS?

I have created an app in objective C, In this app i have one page there User can comment live and for the updating comments i am hitting every 5 min the web-service. I have no idea about the server data change .
I want to hit the service while the data has been change to the server.
Is it possible . Or we can use some other way for the web services.
Thanks, Please answer if you have an correct way to solve it.
Go to this web site PubNub, download SDK's for both Server and Objective-C. PubNub is a common Stream Service with Subscribe/Publish services. After implementing SDK's, make your Client as Subscriber, and make your Server as Publisher. Simply; Subscribers are listening channels for data. When you have a new comment, Publish that comment from Server to channel which your client has already subscribed. Do not forget, free accounts are for demo purposes and have limitations.

Conversations in XMPP

I'm implementing an XMPP Chat and I was wondering if there is any XEP regarding lists of conversations (like WhatsApp). With message archiving, the clients can retrieve the message history with a given user, but if they open the application for the first time, they doesn't know which users they've previously talked to.
I use ejabberd as my server.
Unfortunately, I do not know of such a XEP. Most XMPP systems assume you will have a roster. Then, it's easy to fetch chat history between you and a particular user just by querying the Message Archive (XEP-0313) with that user's JID.
That being said, I also believe a roster-agnostic Chat-partners XEP would be nice to have.

Send XMPP message element multiple destinations (Facebook Chat API)

I'm using Facebook Chat API in an iOS app. I already can send a message successfully to a Facebook friend. Now I'm wondering if a can send the same message to multiple recipients.
I don't know if it's technically possible or there's any limitation about that.
I know that I can create N messages for N users and send one by one. But depending on the number of Facebook friends that the user can select, it can take a long time until all the messages are delivered. If this is the only case, should I open one different thread for each message that is going to be sent with the XMPP stream?
I appreciate any resolution or clue for this question.
There's an XMPP extension XEP-0033: Extended Stanza Addressing which supports multicasting messages to multiple recipients. The extension has progressed to draft status, however few XMPP servers or clients support it. I doubt Facebook Chat does, and couldn't find any mention in the XMPPFramework source.
I don't think there's a better way than sending the same message to multiple recipients. Some servers may require you to pause between sending lots of identical messages, and I wouldn't be surprised if that were true of Facebook Chat.
Multi-User Chat is another way to accomplish this with XMPP, but unfortunately Facebook Chat doesn't support MUC.

Resources