• Like
  • Save
Real time mobile apps with Titanium, Node.ACS and WebSockets
Upcoming SlideShare
Loading in...5
×
 

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

on

  • 12,097 views

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. ...

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.

Statistics

Views

Total Views
12,097
Views on SlideShare
10,248
Embed Views
1,849

Actions

Likes
20
Downloads
0
Comments
1

12 Embeds 1,849

http://ti-news.hatenablog.jp 1316
http://eventifier.co 433
https://twitter.com 50
http://localhost 19
http://eventifier.com 11
http://roshanshow.farayaz.com 9
http://webcache.googleusercontent.com 3
http://storify.com 3
http://www.slashdocs.com 2
http://www.lionsmontefiascone.com 1
http://www.eventifier.co 1
https://storify.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • http://www.kirtiverma.com/
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

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

    • Real time mobile apps with Titanium,Node.ACS and WebSockets Dr. Antonio Calanducci TiConf 2013, Valencia, February 23rd
    • 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
    • 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
    • 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
    • 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 the server (held the connection) returns the response when the server event occurs www.etnatraining.it
    • Other approchesJava AppletsSilverlight duplexFlash WebSockets requires a proprietary runtime installed not proxy and firewall friendly they use proprietary ports www.etnatraining.it
    • 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
    • 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 uses behind thescene different transport mechanisms: WebSocket Adobe Flash Socket AJAX long polling/multipart streaming Forever IFrame / JSONP Polling www.etnatraining.it
    • 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
    • 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/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
    • 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
    • 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 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
    • 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
    • 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 Mobile App front-end yes, socket.io supported there too! Code Walkthrough www.etnatraining.it
    • 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