Node.ACS
Appcelerator Custom Cloud Services

                   Wei Kong
    Director of Engineering, Cloud Services
                Appcelerator Inc.
                  @baobeimm

          wkong@appcelerator.com
Appcelerator
Cloud Services (ACS)
as Instant Mobile
Backend
The Good


           • Easy to use

           • Cross Platform (REST Api based)

           • Predefined object models

           • Custom Objects and Fields

           • No Server Code Needed
What’s Missing


                 • Custom Code

                 • Web Hosting

                 • Support of Custom URLs

                 • Can have extra overhead with
                   the network and battery
                   consumption
Introducing Custom
Cloud Services
(Node.ACS)
Node.js + ACS


                • Complete Solution to your
                  Mobile Backend

                • JavaScript for both Client
                  and Server

                • Fully Integrated with ACS

       JS
Node.js in a Nutshell


                        • Use JavaScript to write
                          Web Servers

                        • Based on Google’s V8 Engine

                        • Event-driven/None-blocking IO

                        • Lightweight and efficient

                        • More at http://nodejs.org
Why Node.js


              • Performance and Scalability

              • Easy to Integrate Network
                Components

              • JavaScript
Node.ACS
Architecture
ACS Network Layer




                    ACS
The Development Flow

                Create a app



                 Test Locally



 Publish to Node.ACS Cloud            Unpublish



              Set Custom Cname
         Ex. http://www.yourapp.com
Multiple Versions
                    your app


   Device
    (v1)               V1




   Device
    (v2)               V2


                       V3

   Device
    (v3)
                      Latest
Demo and
Sample Code
Web Server


             Sample web server to display your
             app data stored in ACS
What’s wrong?

var user = {
  session:"",
};
api.login = function(req, res) {
     if(user.session === ""){
          ACS.Users.login({login: req.body.un,password: req.body.pw},
                function(e) {
                if(e.success && e.success === true){
                      user.session = e.meta.session_id;
                }else{
                      res.redirect(version+'/index?msg='+e.message);
                }
           }, req, res);
     }else{
          res.redirect(version+'/show');
     }
}
Websocket


            A group chat app
            based on websocket
Group Chat

Server Code
websocket.message = function(data, socket) {
   socket.broadcast.emit('message', data);
};
Client Code
// Received a message
iosocket.on('message', function(message) {
     // Display the message
});

// User types a message
$('#outgoingChatMessage').keypress(function(event) {
    iosocket.emit('message', $('#outgoingChatMessage').val());
}
Roadmap
What’s in Preview


                    • One free Node.js Worker/app

                    • 100M Free disk space/app

                    • Unlimited API calls
Coming Soon


              • Background job workers

              • Node.js Monitoring

              • More 3rd party services
                integrations

              • Web Console

              • Flexible free tier

              • Auto sleep and reactivation
Wei Kong
     @baobeimm

wkong@appcelerator.com

Codestrong 2012 breakout session building your own custom cloud services

  • 1.
    Node.ACS Appcelerator Custom CloudServices Wei Kong Director of Engineering, Cloud Services Appcelerator Inc. @baobeimm [email protected]
  • 2.
  • 3.
    The Good • Easy to use • Cross Platform (REST Api based) • Predefined object models • Custom Objects and Fields • No Server Code Needed
  • 4.
    What’s Missing • Custom Code • Web Hosting • Support of Custom URLs • Can have extra overhead with the network and battery consumption
  • 5.
  • 6.
    Node.js + ACS • Complete Solution to your Mobile Backend • JavaScript for both Client and Server • Fully Integrated with ACS JS
  • 7.
    Node.js in aNutshell • Use JavaScript to write Web Servers • Based on Google’s V8 Engine • Event-driven/None-blocking IO • Lightweight and efficient • More at http://nodejs.org
  • 8.
    Why Node.js • Performance and Scalability • Easy to Integrate Network Components • JavaScript
  • 9.
  • 10.
  • 11.
    The Development Flow Create a app Test Locally Publish to Node.ACS Cloud Unpublish Set Custom Cname Ex. http://www.yourapp.com
  • 12.
    Multiple Versions your app Device (v1) V1 Device (v2) V2 V3 Device (v3) Latest
  • 13.
  • 14.
    Web Server Sample web server to display your app data stored in ACS
  • 15.
    What’s wrong? var user= { session:"", }; api.login = function(req, res) { if(user.session === ""){ ACS.Users.login({login: req.body.un,password: req.body.pw}, function(e) { if(e.success && e.success === true){ user.session = e.meta.session_id; }else{ res.redirect(version+'/index?msg='+e.message); } }, req, res); }else{ res.redirect(version+'/show'); } }
  • 16.
    Websocket A group chat app based on websocket
  • 17.
    Group Chat Server Code websocket.message= function(data, socket) { socket.broadcast.emit('message', data); }; Client Code // Received a message iosocket.on('message', function(message) { // Display the message }); // User types a message $('#outgoingChatMessage').keypress(function(event) { iosocket.emit('message', $('#outgoingChatMessage').val()); }
  • 18.
  • 19.
    What’s in Preview • One free Node.js Worker/app • 100M Free disk space/app • Unlimited API calls
  • 20.
    Coming Soon • Background job workers • Node.js Monitoring • More 3rd party services integrations • Web Console • Flexible free tier • Auto sleep and reactivation
  • 21.

Editor's Notes

  • #5 Extending ACS FeaturesWeb ServicesBackground Jobs (Coming soon)Integrations with third party services ACS currently doesn’t support yetMove custom logics from devices to ServerReduce devices network and battery consumptionsSimplify client side developmentReduce app footprintCustom URL 80% job done needs another 20%, background admin job, cms , also performance enhancement
  • #7 Extending ACS FeaturesWeb ServicesBackground Jobs (Coming soon)Integrations with third party services ACS currently doesn’t support yetMove custom logics from devices to ServerReduce devices network and battery consumptionsSimplify client side developmentReduce app footprintCustom URL ----- Meeting Notes (10/11/12 14:13) -----windows update node.ACS logosend it magic
  • #8 Extending ACS FeaturesWeb ServicesBackground Jobs (Coming soon)Integrations with third party services ACS currently doesn’t support yetMove custom logics from devices to ServerReduce devices network and battery consumptionsSimplify client side developmentReduce app footprintCustom URL
  • #11 ----- Meeting Notes (10/11/12 14:13) -----worker? revision slidesReal example (diagram)add a diagram about moving the logic away from client devices,
  • #13 ----- Meeting Notes (10/11/12 14:13) -----diagram needs to be updated
  • #20 Extending ACS FeaturesWeb ServicesBackground Jobs (Coming soon)Integrations with third party services ACS currently doesn’t support yetMove custom logics from devices to ServerReduce devices network and battery consumptionsSimplify client side developmentReduce app footprintCustom URL ----- Meeting Notes (10/11/12 14:13) -----deactivenumer of free workers ?
  • #21 Extending ACS FeaturesWeb ServicesBackground Jobs (Coming soon)Integrations with third party services ACS currently doesn’t support yetMove custom logics from devices to ServerReduce devices network and battery consumptionsSimplify client side developmentReduce app footprintCustom URL ----- Meeting Notes (10/11/12 14:13) -----enterpise connection services, such as SaP ,oracle, salesforce.