We are developing a social based application for android and ios clients, and the backend of app is to develop in meteor.
We are little bit confuse which to be use DDP or REST for the mobile client. Application has twitter like functionality and also user can chat.
Everything is freezed. Please help us to find out the best out of DDP or REST and In which way any suggestion.
you can use both.
DDP is used by meteor and you cant change that that easy
but if you want a public rest api yo can use this: https://atmospherejs.com/nimble/restivus
i dont understand what you mean with: “for the mobile client” ? how are you developing your mobile app ?
from my point of view using DDP on a mobile client only makes sense if you need live data.
Like explained in the description of DDP it is something like “REST for WebSockets”.
You can either use DDP on the mobile client using one of the different libs available or use restivus like lampe said and build your API.
The advantage of using DDP is of course that you have access to most features you already have implemented on the server side whereas using REST you will need to call these methods again when using the API.
If you want to use DDP which I would recommend for you app since it is something like “twitter with chat” you should have a look at these libs: http://meteorpedia.com/read/DDP_Clients
I personally think using DDP is a lot less work if already have got your website up. If you use an REST API you will need to define the routes and all that stuff but that is just my opinion.
DDP makes extremely sense for the chat since that data is fetched live
Yes, you are right we have done all R&D how to implement DDP and REST. I was thinking for chat we’ll use DDP and the other things should be done via REST. Because in the native ios/android there is no Blaze like templating engine and also DDP will consume more battery, internet and bandwidth .
Using DDP for chat makes more than sense.
Since I am not involved in what functionality your app provides I cannot tell how much sense it makes to for example to get all “tweets” as live data.
I am also not sure how much more DDP will consume since if no data is send there are only heartbeats right? But of course you are right it will save battery and bandwidth.
So your idea makes sense.
In DDP there is also problem of file uploading.
Do you know any best way to upload images and videos via mobile ?
and About sending push notifications via meteor server ??
Could you be more specific? What is the exact problem?
I actually dont know how to use DDP to send PushNotifications and if that is possible but you can of course use GCM to send Push Notifications from your server to the device.
If you use Cordova there are some packages which make it simple but since you write native apps you will need to have a look and maybe test it with the libs already given.
I never tried to send push notifications and do file uploads from mobile clients via DDP.
I am working on push notification. i also don’t know how to send push notification. there is a package to send push notification https://atmospherejs.com/raix/push. i am working on this, soon i will find solution.
Now problem is how to upload files from from mobile client. if you find anything please share.
Ok the package looks good. I would give it a try.
I still do not see a problem with that. What is the problem with uploading files from the mobile client?
Problem is in which format we can upload file, the file size, file compression, uploading time etc. we should use amazon s3 service to upload files. this full module is under R&D. i am wondering if anyone can guide me on this.
Actually i am also not sure about all problems. we are working on this so, we can replicate .
For mobile I don’t recommend using DDP. My biggest concern is DDP getting blocked by a firewall. You’re using Meteor as a backend and, as far as I know, there’s no sockJs port to iOS and/or Android. If you use Meteor to develop the mobile app, sockjs will save the day.
Could you explain it a bit more why you wouldn’t use DDP on mobile I dont get it completely what you are saying?
I understand that you have the concern of getting blocked by an firewall (whyever).
What is the problem of not having a sockjs port to Android or IOS?
You wrote that you want to use Meteor as a backend, in my head it’s translate into: We’re using another framework at the front end. If you’re not using javascript at the front-end, you won’t use sockJs unless you write your own version. It means that you can try to use DDP in your mobile app but if the web socket connection gets blocked, you need to write fallback code and also a REST API.
You end up writing a REST API at the end. Keep in mind that I don’t know if this potential issue is relevant. In a Meteor hangout a startup ( Classcraft ) had this problem but got lucky because the sys admin allowed web sockets. ( I was the guy who asked it in the hangout video )
I don’t get an issue related to firewall blocking, we have done experiment on this through native ios framework using DDP client. we did not replicate this issue.
But i’ll also prefer REST API, because there is no proper support for this and lots of issue for mobile client like bandwidth, battery, file uploading etc.
For now we’ll go with REST API bit in the future i’ll surely use DDP for the live data of feeds and messages.
I’m actually working on a similar project and I’ve learned some things along the way. Hopefully this can help you. Here are some things to consider:
DDP will give you reactive data. Certainly use this for chat, but no reason not to use this elsewhere.
DDP (using merge-box) will make sure you don’t send repetitive data over the network, reducing your network load.
I don’t think DDP will have any effect on the battery life of your device. Its using less bandwidth and marginally more computation (devices are so powerful now).
For any native client, you’ll have to build or use someone’s DDP client. The guys at Workpop are using meteor-ios so I think its safe to say that will be a stable solution for a while.
social apps tend to be very relational. Mongodb isn’t just terrible at relational queries – its not meant for relational queries. So think hard about the most challenging queries you’ll have to do and if you end up with a giant $in: [id1, id2, id3, ....], then you shouldn’t be using Mongo.
One solution I’ve been working on is the ccorcos:any-db package so I can use a relational database (I’m using Neo4j) as opposed Mongo. You can define dependencies manually and get reactivity. Or you can just send data to the client as if its a REST API, but using this package and DDP will make sure duplicate data isn’t sent over the network.
Another thing to consider is Native vs Cordova. There are LOTS of trade-offs here.
Thanks ccorcos, for your precious time. for the now i have started with the REST time. but after the completing the base of the app we’ll focus on the DDP.
And i don’t think there is any problem using Mongodb. We can handle this very well to make database relational easily. i had created the database architecture in mongo and its working perfect. i didn’t find any problem in mongo as doing the third project in meteor.
how to sett up server for this library, I made an android native app with https://github.com/delight-im/Android-DDP
library and I use meteor for my web service. I dont remove insecure
package and autopublish package. so I can Insert, delete and update
without subscribe or call the method in client.
but my problem is I can not connect to my localhost. I use genymotion for the android emulator.
Any one can Help me, please, Thank you
It’s my first time to work with Web Socket,
here is my code https://ideone.com/pXzJW8