Rails 3: Real-time server push? - ruby-on-rails-3

I'm trying to write a Rails 3 application in which a server can push data to multiple clients in real time.
I've heard of Juggernaut, but I've also heard that it does not work with Rails 3. I tried APE (AJAX Push Engine), but I'm not having much luck with it.
I'm very new to Rails. I can't find many guides that involve real-time push, and Rails 3. I was looking for a free, easy (if possible) solution to this. If anyone could point me in the right direction, I'd greatly appreciate it.

Check out Faye: http://faye.jcoglan.com/ - I hear really good things about it.
if you're looking for a hosted solution, i've used Pusher http://pusher.com/ in the past, and loved it. i converted a site that used ajax polling over to pusher in about 30 minutes.

You can try juggernaut to do what you want.
The github repository : https://github.com/maccman/juggernaut
Example of application with juggernaut : https://github.com/maccman/holla
Enjoy :)

Have you looked into http://socket.io ? It powers the push functions behind Juggernaut, if I recall correctly.
There appears to be a library for Rails here: https://github.com/markjeee/Socket.IO-rack -- it says 2.3+, which I assume means 3 is ok (though I'm not a Ruby guy, so I wouldn't really know).

In keeping with the Pusher suggestion, there's RMSN - a drop in replacement I've written using NowJS.
https://github.com/leppert/RMSN

Starting with Rails 4, you could also use Entangled:
https://github.com/so-entangled/rails
It basically keeps all data between client and server in sync in real time through web sockets. It's easy to set up, so give it a try.

Related

real time notification in laravel5.4

I am working on laravel notification. Can anyone suggest me how to do the real time notification?
I already go through browser. I didn't found any where correct answer.
Can anyone suggest me how to do that? Or has Laravel have any built function?
I am new to Laravel, so this is my first project I am doing in Laravel. So I am not that much of familiar using Laravel. I tried a lot.
Your post is duplicated...
"Laravel Echo", i think it's what you want for real time notification.
https://laracasts.com/lessons/introducing-laravel-echo
look at this post : Real-time chatting and notifications in laravel 5
You have three options. Either Ajax, WebSocket or Realtime technologies.
In ajax, you need to use setInterval() to check every second.
setInvertal(function(){
fetch_notifications();
}, 1000);
In websocket. It's free but it requires nodejs. Check this. It's laravel 4 but you can easily update to laravel 5. http://www.volkomenjuist.nl/blog/2013/10/20/laravel-4-and-nodejsredis-pubsub-realtime-notifications/
Lastly, using realtime web technologies. Most of them are giving free, it up to you if you want to upgrade your account. Check this lists.
https://www.leggetter.co.uk/real-time-web-technologies-guide/
Laravel recommends using pusher, its good. For my self, I would recommend using PubNub. It's very popular and easy to use. Check this. https://www.pubnub.com/blog/2011-03-19-build-real-time-chat-10-lines-code/
Ably is good too.
Goodluck.

How to set up a server for my app

At the moment I am making an app. I am relatively new but have experience with a lot of different languages like PHP and SQL. My app needs to communicate with a server to post/retrieve data for everyone to see. People also need to be able to login and register. Right now I am using parse because it gives a lot of the requirements in an easy package but parse is retiring soon and I have no experience with setting up my own server.
I was thinking of making my own 'server' from an old computer but not use parse because it will no longer support push notification. Then of course the app needs to communicate with this server. I started looking online and found a lot of terms but not a real clear explanation on how to proceed. I need it to be able to communicate with iOS and Android. Furthermore I was wondering how to execute a script on the server itself. I want to do something with time, once someone uploads something it needs to disappear after 48 hours, but of course it also needs to do this even if the app isn't active on a smartphone
Can anyone tell me how I need to proceed, what to use and where i can find useful info.
My plan for now is creating my own server with something like MongoDB but then i still need something called a backend and different SDK's to communicate with the apps. Maybe its possible to install parse on my own server and add something so i can still use Push and run a script on the server itself.
All help would be very much App-reciated ;)!
The reason of a backend service or framework is to let developer focus on front end app development. Maybe you can check other options like firebase, meoter, or even leancloud. Don't be hurry jump to the decision to make your own backend.
Parse Server is already supporting Push Notifications. I think should keep using Parse. It will become the best framework for backend and API development in a short time. You can also use services like https://www.back4app.com that helps you in all process of configuration of your server.
Do you mean by create your own server running a personal derver pr you mean create your own back end application?

To Make an API Centric Application or Not? - Laravel

So. I have embarked on the journey of learning Laravel in the last couple of weeks, and am thoroughly enjoying it.
It has come time for a site redesign and I thought it was about time to tighten up some of our functionality, so I am making the switch from CodeIgniter to Laravel.
I was wondering whether it is worth starting off with a RESTful API layer in Laravel (easy enough to create) and use it as a base even for the web application. In the future we are likely to build a mobile app that will need to use the API. So:
Is it worth having the web application connect to the API
and what is the easiest way/s to make calls to the API without having to write a bazillion
lines for cURL everytime I want to make a request?
It is definitely worth it.
I am currently redesigning a messy PHP code for an established hosting company turning it into beautiful Laravel code. I already have a mobile app working with it - Laravel makes it easy to return JSON data with one line -
Response::json('OK', 200);
or
Response::eloquent(Auth::user());
or
$tasks = Task::all();
Response::eloquent($tasks);
You don't need to use CURL as far as I know.
You can make all requests with simple AJAX, jQuery would simplify that.
Also using some MVC JS framework would help you make the application code structure more elegant for the client side, and the advantage is that you can easily package that into PhoneGap when you are ready to have your API take some real testing.
Today I posted on my blog about a simple example that you can try to see if this approach is worth your time : http://maxoffsky.com/code-blog/login-to-laravel-web-application-from-phonegap-or-backbone/
Check it out and accept the answer if you think it's on the right track.
As always, your results may vary, but this is exactly what I'm going through at the moment. I'm migrating a large .Net site with this API architecture and I've decided to keep it for Laravel.
I personally decided for this because:
More scalable. I can setup api.domain.com and then add additional
boxes/vm/whatever as our traffic grows. In fact, you could load
balance just the api by "round robin" or multiple dns entries for
that domain.
Future proofing for new sites and apps. Sounds like you're in the
same situation. I can see an app or two being added in the next year
or so.
Lost cost. You'll already be laying out your controllers, so really
it can be just a matter of setting them to RESTful and making small
tweaks to accommodate.
To be fair, some counter points:
Possibly additional load time, from processing through the API, though this should be minimal.
Additional security items to consider if you'd like to lock things down to just your app.
Either way, welcome to Laravel!
and what is the easiest way/s to make calls to the API without having to write a bazillion lines for cURL everytime I want to make a request?
#Sneaksta try postman chrome extension for calling rest services. you can create forms in this extension and pass data from these forms to you Rest services
https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?utm_source=chrome-ntp-icon

Xcode - Web services and my confusion

I am having a problem here. I am totally new to this concept of servers and web services and being able to get data uploaded and retrieved on different devices, but I want to learn it, say if I want to create an app like Instagram.
But that is EXACTLY what I dont want, a link to a long tutorial on the internet on how to create the most complex app ever, I want to start slow. After doing extensive power searches on Amazon there are basically no books that will help me. So I want to start slow, here is my goal:
Get a great understanding of how web service backends and servers work and be able to apply it in other app ideas I have and want to start developing
I would like to start by being able to create an app that allows a user to enter some text into a field, it uploads to the server, another device can press a button to retrieve the text and display it in a text view.
I do not know php, and every single tutorial I have entered on this website is literal mindeff, the reason for this is because everyone has a different solution, sync web service backend with Core Data, MySQL, parse, Rails and it truly overwhelms me because I do not know which one to pick! And even worse some people provide code but I have no understanding whatsoever, and its like looking at a totally new language!
I am not asking for code, in fact that is the exact opposite. I am asking for someone to really lay out their knowledge, how does it all work? What is the best tool? Some resources and links. Nothing too complex...
I hope you can truly understand my extreme confusion and frustration. I think the reason might be is I might not be ready yet for all this, but I want to push forward and carry out my app idea!
Thank you...
Update:
I have finally decided on a web service I would like to use, it is the Amazon S3 web service, I am still not fully comprehending the full process though, any help or ideas!?
Since you wanted to create an Instagram-type app, look at this: http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12
This is a good link to servers: http://www.youtube.com/playlist?list=PLC71D7CFB6AF935E6&feature=plcp. Watch the list to get an understanding of servers.
Maybe you want to read up on sql. Understanding sql will help.. Again: http://www.youtube.com/course?list=EC32BC9C878BA72085&feature=plcp. Watch the list to get an understanding of sql...
I can pass you the link and you got to do the work....
Hope this helps...

Crossbrowser Upload progress meter (without SWFUpload please)

Im trying to make a upload progress meter that works on ALL modern browsers in all operative systems (hence that I don't want to use SWFUpload, since all the demo pages fail in my computer, since I use Ubuntu).
Could someone give me please a hint where to look? I've googled the internet up and down without a solution...
Im running a server with PHP, but APC didnt work, apparently doesnt play nice with lightppd. Also I don't know Perl, so I'd rather not having to learn it for this.
I did this using ASP.NET not long ago. Basically, there's no pure HTML way to do it. What needs to be done, is to make changes on your server (in ASP.NET, I wrote an HttpModule to cache the current status of the upload - for PHP, Ruby, etc, there's likely similar methods to plug into).
Then on the client side - when a file was being uploaded, I made periodic ajax calls to the server to access the upload data that the server was caching. Then, using javascript, I would update whatever HTML progress bar.
You can see plUpload : http://www.plupload.com/
If you're using AJAX, you could go with this solution. And here are a few using jQuery.