SlideShare uma empresa Scribd logo
1 de 11
Google App Engine

Real-time communication using
         Channel API
What Is Google App Engine(GAE)?
• Google App Engine lets you run web applications on
  Google's infrastructure.

• With App Engine, there are no servers to maintain: you
  just upload your application, and it's ready to serve your
  users.

• Google App Engine applications can currently be written
  in Java, Python, or Go.
Push and Pull
• Pull:
  – AJAX


• Push:
  – WebSockets
Channel API(Push)
• Creates a persistent connection between your
  application and Google servers

• Allows your application to send messages to JavaScript
  clients in real time without the use of polling.
Channel API(Push)
Javascript Client:
   – Connecting to the channel once it receives the channel’s unique
     token from the server
   – Listening on the channel for updates
   – Sending update messages to the server
The Server:
   – Creating a unique channel for individual JavaScript clients
   – Creating and sending a unique token to each JavaScript client
     so they may connect and listen to their channel
   – Receiving update messages from clients via HTTP requests
   – Sending update messages to clients via their channels
   – Optionally, managing client connection state.
Channel API(Push)
The Client ID:
   – The Client ID is responsible for identifying individual JavaScript
     clients on the server.
   – A Client ID can be anything that makes sense in the design of
     your application.
Tokens:
   – Tokens are responsible for allowing the JavaScript Client to
     connect and listen to the channel created for it.
   – The server creates one token for each client using information
     such as the client’s Client ID and expiration time.
   – Tokens expire after two hours and should also be treated as
     secret.
Channel API(Push)
The Channel
  – A channel is a one-way communication path through which the
    server sends updates to a specific JavaScript client identified by
    its Client ID.
  – The server receives updates from clients via HTTP requests,
    then sends the messages to relevant clients via their channels.
The Message
  – Messages are sent via HTTP requests from one client to the
    server.
  – Once received, the server passes the message to the
    designated client via the correct channel identified by the Client
    ID.
  – Messages are limited to 32K.
Channel API(Push)
Channel API(Push)
Channel API(Push)
<body>
 <script>
    channel = new goog.appengine.Channel('{{ token }}');
    socket = channel.open();
    socket.onopen = onOpened;
    socket.onmessage = onMessage;
    socket.onerror = onError;
    socket.onclose = onClose;
 </script>
</body>                               sendMessage = function(path) {
                                            path += '?g=' + message;
                                            var xhr = new XMLHttpRequest();
                                            xhr.open('POST', path, true);
                                            xhr.send();
                                       };
Demo: http://gdg-bucharest.appspot.com

Mais conteúdo relacionado

Semelhante a Real-time communication using Google App Engine Channel API

Server Push Technology ( Ratchet )
Server Push Technology ( Ratchet )Server Push Technology ( Ratchet )
Server Push Technology ( Ratchet )Milad Alshomary
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayAmazon Web Services
 
TADSummit Dangerous demo: Oracle
TADSummit Dangerous demo: OracleTADSummit Dangerous demo: Oracle
TADSummit Dangerous demo: OracleAlan Quayle
 
SignalR tutorial & best practices
SignalR tutorial & best practicesSignalR tutorial & best practices
SignalR tutorial & best practicesMinh Ng
 
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha
 
Getting Started with Globus for Developers
Getting Started with Globus for DevelopersGetting Started with Globus for Developers
Getting Started with Globus for DevelopersGlobus
 
Getting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRGetting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRNemi Chand
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...SparkPost
 
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...BizTalk360
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.pptShivaangiKrish
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014Christian Wenz
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.Andrey Oleynik
 
Cache control directive
Cache control directiveCache control directive
Cache control directiveMohamed Mamoon
 
Ws discovery in wcf 4
Ws discovery in wcf 4Ws discovery in wcf 4
Ws discovery in wcf 4sanket2013
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxJason452803
 
Xamarin Form using ASP.NET Core SignalR client
Xamarin Form using ASP.NET Core SignalR clientXamarin Form using ASP.NET Core SignalR client
Xamarin Form using ASP.NET Core SignalR clientChen Yu Pao
 

Semelhante a Real-time communication using Google App Engine Channel API (20)

Server Push Technology ( Ratchet )
Server Push Technology ( Ratchet )Server Push Technology ( Ratchet )
Server Push Technology ( Ratchet )
 
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API GatewayMigrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
Migrate your Existing Express Apps to AWS Lambda and Amazon API Gateway
 
TADSummit Dangerous demo: Oracle
TADSummit Dangerous demo: OracleTADSummit Dangerous demo: Oracle
TADSummit Dangerous demo: Oracle
 
SignalR tutorial & best practices
SignalR tutorial & best practicesSignalR tutorial & best practices
SignalR tutorial & best practices
 
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
 
Postman.ppt
Postman.pptPostman.ppt
Postman.ppt
 
Getting Started with Globus for Developers
Getting Started with Globus for DevelopersGetting Started with Globus for Developers
Getting Started with Globus for Developers
 
SignalR with asp.net
SignalR with asp.netSignalR with asp.net
SignalR with asp.net
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
Getting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalRGetting started with ASPNET Core SignalR
Getting started with ASPNET Core SignalR
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
 
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
Use Windows Azure Service Bus, BizTalk Services, Mobile Services, and BizTalk...
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Cache control directive
Cache control directiveCache control directive
Cache control directive
 
Ws discovery in wcf 4
Ws discovery in wcf 4Ws discovery in wcf 4
Ws discovery in wcf 4
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptx
 
Xamarin Form using ASP.NET Core SignalR client
Xamarin Form using ASP.NET Core SignalR clientXamarin Form using ASP.NET Core SignalR client
Xamarin Form using ASP.NET Core SignalR client
 

Real-time communication using Google App Engine Channel API

  • 1. Google App Engine Real-time communication using Channel API
  • 2. What Is Google App Engine(GAE)? • Google App Engine lets you run web applications on Google's infrastructure. • With App Engine, there are no servers to maintain: you just upload your application, and it's ready to serve your users. • Google App Engine applications can currently be written in Java, Python, or Go.
  • 3. Push and Pull • Pull: – AJAX • Push: – WebSockets
  • 4. Channel API(Push) • Creates a persistent connection between your application and Google servers • Allows your application to send messages to JavaScript clients in real time without the use of polling.
  • 5. Channel API(Push) Javascript Client: – Connecting to the channel once it receives the channel’s unique token from the server – Listening on the channel for updates – Sending update messages to the server The Server: – Creating a unique channel for individual JavaScript clients – Creating and sending a unique token to each JavaScript client so they may connect and listen to their channel – Receiving update messages from clients via HTTP requests – Sending update messages to clients via their channels – Optionally, managing client connection state.
  • 6. Channel API(Push) The Client ID: – The Client ID is responsible for identifying individual JavaScript clients on the server. – A Client ID can be anything that makes sense in the design of your application. Tokens: – Tokens are responsible for allowing the JavaScript Client to connect and listen to the channel created for it. – The server creates one token for each client using information such as the client’s Client ID and expiration time. – Tokens expire after two hours and should also be treated as secret.
  • 7. Channel API(Push) The Channel – A channel is a one-way communication path through which the server sends updates to a specific JavaScript client identified by its Client ID. – The server receives updates from clients via HTTP requests, then sends the messages to relevant clients via their channels. The Message – Messages are sent via HTTP requests from one client to the server. – Once received, the server passes the message to the designated client via the correct channel identified by the Client ID. – Messages are limited to 32K.
  • 10. Channel API(Push) <body> <script> channel = new goog.appengine.Channel('{{ token }}'); socket = channel.open(); socket.onopen = onOpened; socket.onmessage = onMessage; socket.onerror = onError; socket.onclose = onClose; </script> </body> sendMessage = function(path) { path += '?g=' + message; var xhr = new XMLHttpRequest(); xhr.open('POST', path, true); xhr.send(); };