How to refresh data using parse and swift?

Is it possible to use Parse.com for realtime chat (like Socket.io)?

  • I'm trying to build an iOS chat app and thinking about using Parse. There is a blog post out there that claims to have built a chatroom app http://attila.tumblr.com/post/21180235691/ios-tutorial-creating-a-chat-room-using-parse-com but it seems it's not really a 'chat' as in realtime chat--you need to manually pull-to-refresh. Is there a way to do something like this using Parse? Otherwise I will need to just go with node.js/http://socket.io option for backend.

  • Answer:

    You can very rapidly build high quality, high performance real time chat clients + servers with Meteor.js. You can host it yourself or have them host it.

Pradeep Jain at Quora Visit the source

Was this solution helpful to you?

Other answers

I also vote for PubNub.  Perfect framework for this.

Jim Bobrien

You can always go with http://www.PubNub.com. , co-founder, is a friend of mine and his team has made an awesome realtime platform.

Faisal Abid

Short answer, you can't get realtime without using an external solution, but it's pretty easy to add an external service like PubNub to make it happen. Longer answer... Because of the resource limits imposed by Parse on CloudCode functions, it's pretty much impossible to have persistence http://socket.io (with websockets or http-based realtime transport techniques) like connections between Parse and your client. As such, to make realtime chat using Parse or any kind of functionality that requires you to push a message to the client instantly, you're going to have to use some external solution. If you do want to stick to using only Parse, you can use push notifications even though it isn't necessarily realtime and is unreliable at times (I.e. it can a few seconds or minutes for a push notification to get to your client sometimes). For external solutions that are flexible, you can take a look at setting up your own XMPP server or using an IAAS product like PubNub or Pusher. An XMPP server will give you the most flexibility. There are solid open source XMPP servers that you can use and you can connect it to Parse using IronMQ or something. This will give you a polyglot setup with realtime communication abilities for your Parse app. There are XMPP plugins for iOS etc. so you can plug it in with your mobile app and since its robust and built off of HTTP based transport protocols, it'll be better than using a web socket only solution. Pusher was until recently a web socket only (they also had a flash based solution but no HTTP based solution) based service that can give you realtime messaging capabilities and you can hook it up to your Parse app and clients easily. They've recently added HTTP based fallbacks for their JavaScript library, which is awesome, but their mobile clients are still only based on web sockets which can be unreliable in some situations. I personally like the functionality and setup of Pusher a lot more than PubNub (private channels, etc. make things easier on some ways), but until they add fallbacks to their mobile client libraries I chose to go for PubNub instead. PubNub is based on top of XMPP BOSH deep down inside and is super scalable and high performance (or at least that's what they claim, haven't tested out their claims yet). I have used PubNub with my company's parse app to get reliable realtime chat to work and it was pretty easy to hook it all up. You can also have an external node.js server running sock.js or http://socket.io and communicate with it using IronMQ or some other messaging queue to make realtime chat to happen. More work to maintain and scale it though.

Sinchan Banerjee

To build a real-time chat app you need a backend that has real-time chat server (such as XMPP) integrated plus you might want APIs for user authorization, content storage (for file attachments) and push notifications (to notify offline users about new incoming chats). Check out the iOS code samples we have published - these should definitely help: Simple iOS chat sample http://quickblox.com/developers/SimpleSample-chat_users-ios 'Super' sample with extra features of MapChat and AR Chat, also has Facebook integration and push notifications http://quickblox.com/developers/Chattar EDIT Aug'14: Now you may download a ready WhatsApp-style open source messenger project Q-municate for iOS, Android and Web: http://q-municate.com/

Taras Filatov

Firebase is best for deploying real time applications. You can always go with Firebase + AngularJShttps://www.firebase.com/quickstart/angularjs.htmlI've implemented an open chat in one of my hobby project https://github.com/vishwajeetv/ParseAngular-Blogger Live demo - https://vishwajeetv.parseapp.com/ (go to "Chat with Users" tab after logging in)

Vishwajeet Vatharkar

Try https://cloudilly.com/. It's more than a simple pubsub platform. API methods provided are crafted to be suitable for building Group chat and New feeds functionalities, on-demand Uber-like apps, and complex MMORPG games.

Zhongcai Ng

This one worked for me. Following code can auto refresh using NSTimer: [NSTimer scheduledTimerWithTimeInterval:15 target:self selector:@selector(retrievingFromParse) userInfo:nil repeats:YES]; The counter is set to 15, which means it refreshes for every 15 seconds. If you fx set it to 2, it will refresh for every 2 seconds. Implement it under your viewDidLoad in the chat table view. Visit http://www.mastersoftwaresolutions.com/Parse and its blog for recent updates. Hope it helps.

Ravi Garg

Have a look at CloudBoost documentation https://docs.cloudboost.io/.  They have what parse has to offer with realtime notifications which you are looking for. Check this blog which tells how can you implement real time using cloudboost http://blog.cloudboost.io/sending-real-time-web-notifications-web-socket-javascript/

Vipul Maheshwari

As other say, you have to use external solution in order to have a real time messaging service. This is what I'm doing now. My solution is to use Parse to send push notification to the destination to send chat invitation, then when 2 devices are ready to chat, I will use XMPP service to exchange messages for a real-time chat. The requirements are so: - Backend: server XMPP, a lightweight http service to clone PFUser in XMPP server. - frontEnd: Parse, xmpp framework for iOS. With this solution, I will face a problem: for each PFUser in Parse, I have to add (automatically) the same User in XMPP database. I don't know yet what is the right solution for this but I suppose to resolve via Trigger supported in Parse Cloud. This trigger will call the lightweight http in my XMPP server in order to clone this PFUser in my XMPP database. There are many XMPP server that you can download, I use ejabberd made by Synology Community for Synology NAS. You can try also Prosody (https://prosody.im/)   Good luck.

Duyen Hoa HA

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.