Parse Launches Cloud Code to Run Custom Code for Your App
blog.parse.com
blog.parse.com
Also, it seems possible to combine this with IronWorker. You could create a worker in Ruby, then in the Parse Cloud Code, call that worker's endpoint. Something like this (rough sketch):
worker.rb:
require "some_ruby_email_gem"
cgi_parsed = CGI::parse(payload)
email = payload["email"]
SomeRubyEmailGem.send(email, "Welcome, #{email}!")
upload.rb: require 'iron_worker_ng'
client = IronWorkerNG::Client.new(:token => config['iw']['token'], :project_id => config['iw']['project_id'])
code = IronWorkerNG::Code::Ruby.new
code.merge_worker 'worker.rb'
code.merge_gem "some_ruby_email_gem"
client.codes.create(code)
url = "https://worker-aws-us-east-1.iron.io/2/projects/#{config['iw']['project_id']}/tasks/webhook?code_name=#{code.name}&oauth=#{config['iw']['token']}"
puts "Add this url to to your Parse Cloud Code:"
puts url
Parse Cloud Code: Parse.Cloud.define("welcome, function(request, response) {
var user = request.object.get("user");
var url = "https://worker-aws-us-east-1.iron.io/2..." // the url from upload.rb
http.open("POST", url+"?email="+user.email, true);
});
EDIT: HTTP requests to 3rd parties within Cloud Code are not possible yet, but Parse will add the feature soon. (http://twitter.com/ParseIt/status/245584646686003200)I have an app that basically tracks donations for different campaigns. Getting total donations per campaign isn't easy with the current API. There is nothing like a "select sum()" statement in Parse. Basically I currently have to run a cron job on my machine that will periodically download all donations by campaign and update the total donations field on the campaign (the regular user account doesn't have privileges to edit the campaign object).
This seems like it will be a much cleaner, saner way to take care of this type of task.
Neither of these, however, are that complex to do, and the value of both of these drops dramatically once you start writing server-side logic in Java.
Edit: Huh? Why was this downvoted? The problem I've had with Parse for a long time was that I still needed a separate server to do some backend processing that was not feasible to do on a client. Now I may no longer have need for that server.
http://weblogs.asp.net/scottgu/archive/2012/08/28/announcing...
I've been using parse on a project and was missing this functionality.
As a side note, I'm loving parse, but their iOS SDK is poorly designed. Like really badly designed. I had a few email exchanges with one of their devs, but it didn't really seem to go anywhere. You can't create subclasses of any of their objects because they like using static methods versus singleton instances. It's really stupid and it really ties you to using parse. You also have shit like this everywhere:
NSString *someval=[pfobject objectForKey:@"shit"];
Where this would be preferred: NSString *someval=mySubclass.shit;
So you can create a wrapper/shim for PFObject, but that doesn't float across queries returning arrays of objects.And, yes, I considered writing my own wrapper around their REST API but I don't have that kind of time.
Step in the right direction though.
a cloud code request probably can't fit within the pricing model posted on the parse site as a single API request because it may presumably have huge variance in resource consumption. like what's to stop someone from use parse's resources to run bitcoin miners?
Edit: Confirmed! https://news.ycombinator.com/item?id=4506783
I worked on it for about 6 months and then Apple released Game Center. It was pretty clear that my service would be eclipsed by Game Center so I threw in the towel on it.
At the time, I was targeting Node.js on the server and wrote a fledgling sand-boxing tool called Jefe [1].
I'm using Parse in my current app (Lexatron [2]) and I'm loving it. I'm looking forward to see what I can run on the server side.
Full circle!
p.s. My last name is Lackner. Glad to meet someone else with the unfortunate Lack- prefix.
Another question (just curious): why did you cut node out entirely? libev is awesome and it seems like you would basically have to rewrite if you used straight C++.
These guys will never be bought by a bigger company with nothing but profits in mind?
Deleted comment