Your SlideShare is downloading. ×
Real time mobile apps     with Titanium,Node.ACS and WebSockets                       Dr. Antonio Calanducci        TiConf...
OutlineApproaches for real time apps over HTTPHTML 5 WebSockets  socket.ioNode.ACS overview  MVC FrameworkDEMO (please dow...
About meFounder of  first Italian Appcelerator Training Partner  we run Titanium classes in 8 cities in ItalyTitanium and A...
Problem: Real Time apps over HTTP Build (event-driven) web/mobile apps that communicates with the server Hard to implement...
AJAX pollingclient makes a request every n secondsserver returns immediately a response                www.etnatraining.it
COMET (long polling)aka reverse AJAX, AJAX push, HTTP server push  client makes a request to server for updates  wait at t...
Other approchesJava AppletsSilverlight duplexFlash WebSockets  requires a proprietary runtime installed  not proxy and fire...
Entering WebSocketsprovides a bidirectional and full-duplexcommunication channel servers and (web) clientsit works over a ...
WebSocket API   www.etnatraining.it
WebSockets browser support         www.etnatraining.it
Socket.ioNot all browsers support WebSockets (at least olderones)we could use fallbacksSocket.io: javascript library that ...
Node.jsBuild Backends/Web Servers with JavaScriptBased on Google V8Asyncronous I/O  non blocking  event drivenLightweight ...
Socket.io in Node.JSNode.js provides a socket.io moduleClient:                  www.etnatraining.it
WebSockets/Socket.io in Titanium? Contributed open source Modules Both for iOS and Android:   https://github.com/iamyellow...
Introducing Node.ACSAppcelerator Node.JS hosting solution  Build custom services to extend the existing  Appcelerator Clou...
Architecture  www.etnatraining.it
Development Flow    www.etnatraining.it
Node.ACS MVCExpress 3.x based  provides a MVC framework like  Sinatra/RubyOnRails  you define routes, filters,  websockets e...
Node.ACS MVC: config.jsonpath: URL to map; method: [get | post | put | delete ..]callback: <controllers/filename.js>#<functi...
Node.MVC: controllers example/controllers/users.js/websockets/chat.js                    www.etnatraining.it
DEMO TIMEhttp://www.etnatraining.it/ticonf-demo/
Real time SurveyNode.ACS on the server side  with socket.ioTitanium on the client side to build:  iOS  Android  HTML5 Mobi...
Referenceshttps://github.com/EtnaTraining/ticonf-demohttps://github.com/EtnaTraining/ticonf-demo-node.acs-serverhttp://soc...
Upcoming SlideShare
Loading in...5
×

Real time mobile apps with Titanium, Node.ACS and WebSockets

13,109

Published on

In this talk, given at First European Conference on Titanium (http://ticonf.eu), we present an overview of the approaches to implement realtime apps over HTTP and introduce the benefit of WebSockets. Later we introduce Node.ACS and Socket.IO to demonstrate how we built a realtime survey system that works on iOS, Android and HTML5 browsers with Titanium.

Published in: Technology
1 Comment
22 Likes
Statistics
Notes
  • http://www.kirtiverma.com/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
13,109
On Slideshare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
0
Comments
1
Likes
22
Embeds 0
No embeds

No notes for slide

Transcript of "Real time mobile apps with Titanium, Node.ACS and WebSockets"

  1. 1. Real time mobile apps with Titanium,Node.ACS and WebSockets Dr. Antonio Calanducci TiConf 2013, Valencia, February 23rd
  2. 2. OutlineApproaches for real time apps over HTTPHTML 5 WebSockets socket.ioNode.ACS overview MVC FrameworkDEMO (please download http://bit.ly/ticonf ) implement a real time survey system with Node.ACS and Titanium www.etnatraining.it
  3. 3. About meFounder of first Italian Appcelerator Training Partner we run Titanium classes in 8 cities in ItalyTitanium and Apple Certified TrainerResearcher at the National Institute of NuclearPhysicsContact me : antonio@etnatraining.it; @tcaland / @etnatraining www.etnatraining.it
  4. 4. Problem: Real Time apps over HTTP Build (event-driven) web/mobile apps that communicates with the server Hard to implement with the HTTP protocol: HTTP is half duplex HTTP requires establishing a TCP connection latency, overhead sending a request / getting a response 800b ~ 1.5kb www.etnatraining.it
  5. 5. AJAX pollingclient makes a request every n secondsserver returns immediately a response www.etnatraining.it
  6. 6. COMET (long polling)aka reverse AJAX, AJAX push, HTTP server push client makes a request to server for updates wait at the server (held the connection) returns the response when the server event occurs www.etnatraining.it
  7. 7. Other approchesJava AppletsSilverlight duplexFlash WebSockets requires a proprietary runtime installed not proxy and firewall friendly they use proprietary ports www.etnatraining.it
  8. 8. Entering WebSocketsprovides a bidirectional and full-duplexcommunication channel servers and (web) clientsit works over a single TCP connection shares port with HTTP (80) and HTTPS (443) proxy and routers friendly / cross-origin API stardardized by W3C and IETF protocol (part of HTML5) lightweight (2bytes header per message exchange) only one connection is established (latency low) www.etnatraining.it
  9. 9. WebSocket API www.etnatraining.it
  10. 10. WebSockets browser support www.etnatraining.it
  11. 11. Socket.ioNot all browsers support WebSockets (at least olderones)we could use fallbacksSocket.io: javascript library that uses behind thescene different transport mechanisms: WebSocket Adobe Flash Socket AJAX long polling/multipart streaming Forever IFrame / JSONP Polling www.etnatraining.it
  12. 12. Node.jsBuild Backends/Web Servers with JavaScriptBased on Google V8Asyncronous I/O non blocking event drivenLightweight and efficientWORKSHOP 2: “An introduction and primer toNode.JS” - by Dave Mackintosh www.etnatraining.it
  13. 13. Socket.io in Node.JSNode.js provides a socket.io moduleClient: www.etnatraining.it
  14. 14. WebSockets/Socket.io in Titanium? Contributed open source Modules Both for iOS and Android: https://github.com/iamyellow/tiws https://marketplace.appcelerator.com/apps/ 2825?793640832 https://marketplace.appcelerator.com/apps/ 3158?365421049 support for pure WS events, socket.io and now.js www.etnatraining.it
  15. 15. Introducing Node.ACSAppcelerator Node.JS hosting solution Build custom services to extend the existing Appcelerator Cloud Services (ACS) Host your existing node.js app/service on the Appcelerator Cloud Create Node.ACS apps directly from Titanium Studio or from CLIcan interact with ACS (see Javier presentation on ACS)Actually in Developer Preview state www.etnatraining.it
  16. 16. Architecture www.etnatraining.it
  17. 17. Development Flow www.etnatraining.it
  18. 18. Node.ACS MVCExpress 3.x based provides a MVC framework like Sinatra/RubyOnRails you define routes, filters, websockets event handlers that map to controllers it takes care for you all the details of configuring the environment you focus on the app’s features www.etnatraining.it
  19. 19. Node.ACS MVC: config.jsonpath: URL to map; method: [get | post | put | delete ..]callback: <controllers/filename.js>#<function_name>event: name of the event emitted www.etnatraining.it
  20. 20. Node.MVC: controllers example/controllers/users.js/websockets/chat.js www.etnatraining.it
  21. 21. DEMO TIMEhttp://www.etnatraining.it/ticonf-demo/
  22. 22. Real time SurveyNode.ACS on the server side with socket.ioTitanium on the client side to build: iOS Android HTML5 Mobile App front-end yes, socket.io supported there too! Code Walkthrough www.etnatraining.it
  23. 23. Referenceshttps://github.com/EtnaTraining/ticonf-demohttps://github.com/EtnaTraining/ticonf-demo-node.acs-serverhttp://socket.io/https://github.com/LearnBoost/socket.io/wiki/http://nodejs.orghttps://github.com/iamyellow/tiwshttp://nodeacs.cloud.appcelerator.com/guides/quickstarthttp://nodeacs.cloud.appcelerator.com/guides/mvc www.etnatraining.it

×