SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Bergmans Mechatronics LLC

 HTML5 WebSocket - Enabling Technology for
        Dynamic W b A li i
        D    i Web Applications


                                John Bergmans
                       Bergmans Mechatronics LLC
                                www.bergmans.com




                            HTML5 & CSS3 User Group LA
                                  Los Angeles, CA
                                   Jan 26 2011


1616 Bedford Lane, Unit A                                Phone: 714-474-8956
Newport Beach, CA 92660                                    Fax: 949-646-1429
Bergmans Mechatronics LLC
Speaker Intro
• Operating Bergmans Mechatronics since 2003
• Real-time Web App researcher
• Developer of data acquisition and control systems, using LabVIEW and C




                     Rocket Motor Data Acquisition and Control Systems
                                                     Ethernet Router
                                                                       Laptop
                              LasIR                                                                           Steel Ball
                                                                                Electromagnet
                                                                                         g
                         NH3 M it
                             Monitor




                        Laser Alignment System
                                 Processing Unit                                                                     IR LED Port

                                                                                                                   Photodiode Detector Port




    Laser-Based                               Laser Alignment                               Control System Technology
   Instrumentation                                System                                          Demonstrator
Bergmans Mechatronics LLC
  Generalized Technology Trends

    Distributed
                   mainframes


                  dumb terminals                              commodity servers


                                                        desktops
                                                        d kt           laptops
                                                                       l t         mobile
                                                                                     bil


                     ‘60s – ’70s          ‘80s – ’90s                  today
                                                                           y           Time
                                    workstations,
                                    desktops
   Standalone

                                                                                    Fiber to
Communications                                                                       Home
        Speed
        S    d                                               DSL / cable         (2+ Gbit/sec)
                                                            (~10 Mbit/sec)
                      Phone modem
                    0.300
                    0 300 – 56 kbit/sec                             Note: SATA 2.0 = 2 4 Gbit/s
                                                                               2 0 2.4
Bergmans Mechatronics LLC
Generalized Technology Trends
• Increasing communications speeds, low cost commodity servers, low-cost high
  performance “terminals” (Cloud access speed = local drive access speed)
           p
           promotes trend towards distributed, browser-based apps
                                             ,                pp
           (eg. Google Docs)

• Limitation of legacy browsers - no TCP/IP socket connectivity
                  g y                                         y
            forces use of HTTP request/response

• WebSockets
   • socket-like connectivity for browsers
   • enabling technology for distributed apps
Bergmans Mechatronics LLC
Overview

• Review of current techniques for dynamic web applications

• WebSocket introduction

• WebSocket demonstration applications
                           pp
Bergmans Mechatronics LLC
Polling




          Image Copyright © 2011 - Kaazing Corporation Used by Permission
                                           Corporation.        Permission.
Bergmans Mechatronics LLC
Long Polling




               Image Copyright © 2011 - Kaazing Corporation Used by Permission
                                                Corporation.        Permission.
Bergmans Mechatronics LLC
WebSocket

   •   Enables continuous, bidirectional communications between browser
       and server

   •   Specification defined by W3C (API) and IETF (protocol)

   •   Simple browser and back-end implementation

   •   Substantially reduced header info size
       (request and response: ~900 b t vs W bS k t 4 b t )
       (      t d              900 bytes      WebSocket: bytes)
Bergmans Mechatronics LLC
Browser/Back-End Communications

                      Traditional interface between browser and web server

                                1) Data Request
                                                     Web Server     Back-End
            Browser             2) Reply              Software     Application


         Desktop
         D kt                                     Server
                                                  S
Bergmans Mechatronics LLC
Browser/Back-End Communications

                      Traditional interface between browser and web server

                                 1) Data Request
                                                          Web Server     Back-End
            Browser              2) Reply                  Software     Application


         Desktop
         D kt                                          Server
                                                       S




              Continuous bi-directional communication between browser
                            and server using WebSocket


                              Data to Back-End App
                                                            WebSocket    Back-End
            Browser
                              Data from Back-End App         Server     Application


         Desktop                 WebSocket             Server
Bergmans Mechatronics LLC
Simple and Standardized API
// Handler for Connect button
        connect.onclick = function() {
            websocket = new WebSocket(location_.value);

            websocket.onopen = function(evt) {
                log("CONNECTED");
                connect.disabled = true;
                disconnect.disabled = false;
                send.disabled = false;
            }

            websocket.onmessage = function(evt) {
                response("RESPONSE: " + evt.data);
            }

            websocket.onclose = function(evt) {
                log("DISCONNECTED");
                connect.disabled = false;
                disconnect.disabled = true;
                send.disabled = true;
            }
       };

       // Handler for Send button
       send.onclick = function() {
           log("SENT: " + message.value);
           websocket.send(message.value);
       };

       // Handler for Disconnect button
       disconnect.onclick = function() {
           websocket.close();
       };
                                                          Code and Image Copyright © 2011 - Kaazing Corporation.
                                                          Used by Permission.
Bergmans Mechatronics LLC
Wireshark Trace of Echo Demo

           Client to Server:
           GET /echo?.kl=Y HTTP/1.1
           Upgrade: WebSocket
           Connection: Upgrade
           Host: student1.html5project.com:8001
           Origin: http://student1.html5project.com:8000
           Sec-WebSocket-Key1: 255742716( |7
           Sec-WebSocket-Key2: Lr C 45 7     9E52 %] 78;w qo4
           Cookie:
           KSESSIONID=1kRqopFaGlLI6ioKPg5lj6I0gq+MT2TPo2gpKeqqeQm2bCcbesF+7A==

           i......K
           Server to Client:
           HTTP/1.1 101 Web Socket Protocol Handshake
           Upgrade: WebSocket
           Connection: Upgrade
           Sec-WebSocket-Origin: http://student1.html5project.com:8000
           Sec-WebSocket-Location:
           ws://student1.html5project.com:8001/echo?.kl=Y
           Server: Kaazing Gateway
           Date: Mon, 24 Jan 2011 21:55:31 GMT
           Access-Control-Allow-Origin: http://student1.html5project.com:8000
           Access-Control-Allow-Credentials: true

           .....w.......fw.....N.

           Client to Server:
           .Hello, WebSocket!.
           Server to Client:
           .Hello, WebSocket!.

                                                 Copyright © 2011 - Kaazing Corporation. Used by Permission.
Bergmans Mechatronics LLC
WebSocket

   •   Multiple organizations developing WebSocket servers

        System                           Developer
        em-websocket                     Ilya Grigorik of PostRank with other
                                         contributors
        jWebSocket                       jWebSocket.org
        Jetty W bS k t S
        J tt WebSocket Server            Jetty
                                         J tt
        Kaazing WebSocket Gateway        Kaazing Corp
        pywebsocket                      pywebsocket opensource project
        Pusher (based on em-websocket)   New Bamboo
        Resin
        R i                              Caucho T h l
                                         C     h Technology I  Inc.



   •   Kaazing Corp., Mountain View, CA (
             g    p,               ,    (www.kaazing.com)
                                                    g     )
        • Developer of commercial WebSocket gateway
        • Emulation for legacy and mobile browsers
        • User authorization
        • Secure WebSockets
        • Contributor to HTML5 spec
        • Disclosure: BML has referral agreement with and is contractor to
          Kaazing
Bergmans Mechatronics LLC
EarthControl – Multiplayer Facebook Game




                    http://apps.facebook.com/earthcontrol
Bergmans Mechatronics LLC
Browser – Server Architecture for EarthControl Application
             Game 1 Browsers                           Game 2 Browsers                         Game n Browsers



   Browser      Browser          Browser     Browser     Browser         Browser     Browser     Browser         Browser
      1            2                8           1           2               8           1           2               8




                                                         Kaazing
                                                        WebSocket
                                                         Gateway



                                                         ActiveMQ
                                                          Server



                  EarthControl       EarthControl       EarthControl       EarthControl
                    Admin              Game 1             Game 2             Game n
                                                                                               Legend
                                                                                                        STOMP Message
                                                                                                        MySQL Query / Result
                                                          MySQL
                                                         Database                                       Game Instance
                Linux Server
                Li    S                                                                                 Initialization
                                                                                                        I iti li ti
Bergmans Mechatronics LLC

Performance
• Typical server transmit rate to each browser:
     char string approximately 340 character in length at about 10 Hz ≈ 3400 bytes/sec

• Latency between user input and display update: <~100 ms.

• Kaazing’s WebSocket Emulation enables WebSocket capability on current non-HTML5
browsers

• EarthControl functions well using these browsers
     • Google Chrome (
            g           (version 2.0 or later)
                                             )
     • Safari (version 4.0 or later)
     • Firefox (version 3.0 or later)
     • Internet Explorer (version 7.0 or later)
Bergmans Mechatronics LLC

Browser - Server Interfacing (Steady State)
Facebook iFrame

  iFrame

   EarthControl_client.html


    function setup()                                                        EarthControl.php
                                                                            E thC t l h
      {                               Topic “/topic/fromBrowserYY”            (instance YY)
      user-initiated events trigger   Data ship_index, keypress data, etc
                  stomp.send()
                                                                             Real-time game
                                                                                       g
                                      Topic ” /topic/toBrowserXX_YY”           support for
                                      Data display data                         game YY
      stomp.onmessage()
        {
        update display
        }
      }



                                        XX = ship index number                   Server
                                        YY = game id number


                  Browser
Bergmans Mechatronics LLC

Browser - Server Interfacing (including Handshaking)
Facebook iFrame
EarthControl.php              iFrame                              UID = User ID number
                                                                  XX = ship index number
$facebook->api_client->      EarthControl_client.html             YY = game id number
                                                                       g
users_getInfo;
users getInfo;
                              function pre_setup()
function         user info      {
handleResponse()                handleResponse()
                                                                                                        EarthControl_Admin.php
                                }                                                                              Subscribe to topic
                              function setup()                   Topic “/topic/fromBrowser_Admin”        “/topic/fromBrowser_Admin”
                                {                                D t user i f (name, UID, etc)
                                                                 Data      info (      UID t )
                                pre_setup()                                                              - Query SQL database
                                stomp.onopen()
                                                                                                         - Assign game and
                                  {
                                                                 Topic “/topic/toBrowser_Admin_UID”        ship_index
                                  • subscribe to topic
                                  “/topic/toBrowser_Admin_UID”   Data game_id, ship_index                - Start new game instance
                                  • send user info                                                         (if necessary)
                                  }
                                stomp onmessage()
                                  {                                                                           EarthControl.php
                                  if handshaking                                                                (instance YY)
                                     • subscribe to top c
                                       subsc be topic            Topic “/topic/fromBrowserYY”
                                                                        /topic/fromBrowserYY
                                     “/topic/toBrowserXX_YY”                                                    Subscribe to topic
                                                                 Data ship_index, “new_player” signal
                                     • send user info                                                       “/topic/fromBrowserYY”
                                  else                                                                           Handshaking
                                                                 Topic “/topic/toBrowserXX_YY”
                                     • normal data
                                                                 Data field data
                                     processing                                                           Real-time game support for
                                                                                                                  game YY
                                  }                              Topic “/topic/fromBrowserYY”
                                                                 Data ship_index, keypress data, etc
                                • user-initiated gui events
                                • stomp.connect()
                                }


                             Browser                                                                           Server
Bergmans Mechatronics LLC
Cloud Server Monitor

• Monitor server performance without browser polling
• Provides output of “top” and “vmstat” to browser.
• Update rates:
    • top: 2 Hz
    • vmstat: 1 Hz
• Plots “top” output in HTML5 <canvas> element
         top
• Idea for future work:
    • Monitor and control of multiple servers


             Browser on
             Desktop or
            Mobile Device   Data transfer
                            D t t     f
                                via
                            WebSocket

                                            WebSocket   Message     Monitor
                                             Gateway     Broker     Agent


                                                        Server
Bergmans Mechatronics LLC
Cloud Server Monitor
Bergmans Mechatronics LLC
Remote Access to LabVIEW Application
• Goal: monitor and control a LabVIEW application using a plug-in-free browser


               LabVIEW
                                                                Browser on
               Application
                                                                 Laptop,
                                                                Desktop or
               Desktop /                                       Mobile Device
            Embedded Device




• Potential Use-Cases

    • Monitor and control a LabVIEW-controlled lab test from the desktop in office
      or on the road using a mobile device

    • Monitor large-scale LabVIEW application by crews in the field – ie oil rig
      equipment monitoring
         i      t    it i

    • For low-cost embedded systems – eliminate physical UI by using browser to
      interface to device
Bergmans Mechatronics LLC
“LabSocket” = LabVIEW + WebSocket

LabSocket system uses WebSockets to enable automatic replication of LabVIEW
front panel in a browser without plug-ins



      LabSocket                       Message        WebSocket
       Interface
       I t f                           Broker
                                       B k            Gateway
                                                      G t
      LabVIEW         Data transfer
                                                                  Data transfer
      Application         via               Server                                 Browser on
                                                                      via
                     TCP/IP Socket                                                 Desktop or
                                                                  WebSocket
      Desktop /                                                                   Mobile Device
   Embedded Device
Bergmans Mechatronics LLC
“LabSocket” = LabVIEW + WebSocket

LabSocket system uses WebSockets to enable automatic replication of LabVIEW
front panel in a browser without plug-ins



      LabSocket                       Message        WebSocket
       Interface
       I t f                           Broker
                                       B k            Gateway
                                                      G t
      LabVIEW         Data transfer
                                                                  Data transfer
      Application         via               Server                                 Browser on
                                                                      via
                     TCP/IP Socket                                                 Desktop or
                                                                  WebSocket
      Desktop /                                                                   Mobile Device
   Embedded Device



   LabSocket Interface

   Startup
        - Establish TCP/IP socket connection to message broker
        - LabVIEW Front Panel Screen Scrape, send JavaScript code to web server
   Steady-state
        - Transmit updates in LabVIEW front panel to browser
        -U d
          Update L bVIEW f
                  LabVIEW front panel b
                                     l based on events generated i b
                                           d                   d in browser
Bergmans Mechatronics LLC
“LabSocket” = LabVIEW + WebSocket
• Video: http://screencast.com/t/eKuQ02PAdo

              LabVIEW                         Browser
Bergmans Mechatronics LLC
Screenscrape SubVI




                     Label for one LED
Bergmans Mechatronics LLC
WebSocket as Alternative to HTTP Request-Response
• Initial investigation into use of WebSocket to improve performance of HTTP-
  based phpMyAdmin
Bergmans Mechatronics LLC

WebSocket as Potential Alternative to HTTP Request-Response
phpMyAdmin – Popular MySQL Interface




“Navigation” Frame                            “Content” Frame

  Hyperlink in HTML code for this single GUI element
Bergmans Mechatronics LLC

phpMyAdmin – How It Works

       Browser                                                                                Server

1.   User clicks on
     hyperlink in GUI
2.   JavaScript creates
     http
     htt request t
                           http request for updated frame:
                           http://sql.php?db=...&table=...&sql_query=...&token=...
                                                                                     3.   Confirm that this is an
                                                                                          authentic request
                                                                                     4.   Process MySQL query
                                                                                     5.   Generate new Content
                                                                                          frame with http
                                                                                          requests in hyperlinks
                                                                                          for each active element
                                                                                          (including all MySQL
                          html code for new frame which includes                          queries)
                          for every GUI element:
                             p q p p                       q _q y
                          http://sql.php?db=...&table=...&sql_query=...&token=...
                                                                                     6.   Send new html code
                                                                                          for f
                                                                                          f frame to browser
                                                                                                       b
7.   Render page
Bergmans Mechatronics LLC

WebSocket-MyAdmin – Simplified WebSocket-based MySQL Interface
• Objective: To illustrate performance improvements available by using WebSocket




                                                                                   HTML for this element




 Event handlers are programmatically assigned to each active GUI element in client-side JavaScript.
 eg. Columns heading event handlers are assigned using:




 If “col1” is pressed client sends to server via WebSocket: “col_heading,col1”
Bergmans Mechatronics LLC

WebSocket-MyAdmin – How it Works

        Browser                                                                       Server

1.   User action within
     GUI creates an event
2.   Event handler creates
     event notification
     message                  Signal representing required action, eg:
                              “col_heading,col1”
                                                                         3.    Create MySQL query for
                                                                               this action
                                                                         4.    Process MySQL query
                                                                         5.    Generate new GUI
                                                                               elements and events
                             Browser control signals and data
                             1.   del_html,                              6.    Send GUI elements and
                             2.   add_html,<table><tr><td> ….                  events to browser
                                  </td></tr></table>
                             3.   add_column_event,col0…
7.   Delete existing                                                          Note: In current demo, html code
     table                                                                    and events for entire table are
                                                                              sent from server to browser. A
8.   Create new table                                                         more refined approach would be
9.   Create new event                    WebSocket                            to update only those elements
                                         Connection                           which have changed.
     handlers
Bergmans Mechatronics LLC

Test Results

Testing two cases for WebSocket configuration (with and without element events)
and phpMyAdmin. In all cases – column sort of 10x10 matrix

• WebSocket interface was always faster
• Relative to phpMyAdmin more data transferred with element events, slightly
  less t
  l    transferred without element events (Note – phpMyAdmin d
            f    d ith t l       t     t (N t      h M Ad i does not allow i
                                                                     t ll    in-
  table element editing)

                         Number of packets              Number of bytes               Update time (sec)
                     phpMy           WS-           phpMy           WS-           phpMy            WS-
                     Admin        MyAdmin          Admin        MyAdmin          Admin         MyAdmin
                               with        no                with        no                 with        no
                             element    element            element    element             element    element
                              events     events             events     events              events     events
 Browser to Server
 Server to Browser
 Total                    35        48        16     11901     36773      8638    1.16      0.53      0.43
Bergmans Mechatronics LLC
Future Work
• LabVIEW Cloud service
    • Allow LabVIEW developers to automatically set up applications
    • Subscription set up
             p          p
    • Improved GUI element support

• Development of Demo Apps / Custom Applications
        p              pp            pp

• Research
    • Investigation in other applications for WebSocket
    • Further comparisons of WebSockets to HTTP

Más contenido relacionado

La actualidad más candente

Network Storage: State of the Industry
Network Storage: State of the IndustryNetwork Storage: State of the Industry
Network Storage: State of the IndustryIMEX Research
 
Sunrise Electronic Brochure
Sunrise Electronic Brochure Sunrise Electronic Brochure
Sunrise Electronic Brochure gmead2
 
Quality of Experience
Quality of ExperienceQuality of Experience
Quality of ExperienceThomas Kernen
 
Network Assurance and Testing During the Migration to VoIP
Network Assurance and Testing During the Migration to VoIPNetwork Assurance and Testing During the Migration to VoIP
Network Assurance and Testing During the Migration to VoIPVideoguy
 
What Mobile Developers Should Know
What Mobile Developers Should KnowWhat Mobile Developers Should Know
What Mobile Developers Should KnowMobiVentures
 
4 g world 2011 renesas mobile overview
4 g world 2011 renesas mobile overview4 g world 2011 renesas mobile overview
4 g world 2011 renesas mobile overviewDavid McTernan
 
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)NGN Test Centre
 
Presentation from physical to virtual to cloud emc
Presentation   from physical to virtual to cloud emcPresentation   from physical to virtual to cloud emc
Presentation from physical to virtual to cloud emcxKinAnx
 
SSNS 2012 Detailed Services Presentation
SSNS 2012 Detailed Services PresentationSSNS 2012 Detailed Services Presentation
SSNS 2012 Detailed Services Presentationcampojo
 
Mobile App Assurance: Yesterday, Today, and Tomorrow.
Mobile App Assurance: Yesterday, Today, and Tomorrow.Mobile App Assurance: Yesterday, Today, and Tomorrow.
Mobile App Assurance: Yesterday, Today, and Tomorrow.Bob Binder
 
Advancing the Traditional Enterprise: An EA Story
Advancing the Traditional Enterprise: An EA Story Advancing the Traditional Enterprise: An EA Story
Advancing the Traditional Enterprise: An EA Story InnoTech
 
Cradle Point Mbr900
Cradle Point Mbr900Cradle Point Mbr900
Cradle Point Mbr900guest6c447e5
 

La actualidad más candente (19)

Network Storage: State of the Industry
Network Storage: State of the IndustryNetwork Storage: State of the Industry
Network Storage: State of the Industry
 
Sunrise Electronic Brochure
Sunrise Electronic Brochure Sunrise Electronic Brochure
Sunrise Electronic Brochure
 
E-commerce
E-commerceE-commerce
E-commerce
 
Performance Vision - What's new in version 2.9
Performance Vision - What's new in version 2.9Performance Vision - What's new in version 2.9
Performance Vision - What's new in version 2.9
 
Quality of Experience
Quality of ExperienceQuality of Experience
Quality of Experience
 
Programmable WAN Networking is SFW
Programmable WAN Networking is SFWProgrammable WAN Networking is SFW
Programmable WAN Networking is SFW
 
Network Assurance and Testing During the Migration to VoIP
Network Assurance and Testing During the Migration to VoIPNetwork Assurance and Testing During the Migration to VoIP
Network Assurance and Testing During the Migration to VoIP
 
What Mobile Developers Should Know
What Mobile Developers Should KnowWhat Mobile Developers Should Know
What Mobile Developers Should Know
 
Network data
Network dataNetwork data
Network data
 
4 g world 2011 renesas mobile overview
4 g world 2011 renesas mobile overview4 g world 2011 renesas mobile overview
4 g world 2011 renesas mobile overview
 
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)
The NGN Test Centre Infrastructure & Services - Shane Dempsey (NGN Test Centre)
 
Presentation from physical to virtual to cloud emc
Presentation   from physical to virtual to cloud emcPresentation   from physical to virtual to cloud emc
Presentation from physical to virtual to cloud emc
 
4 gwes2012
4 gwes20124 gwes2012
4 gwes2012
 
SSNS 2012 Detailed Services Presentation
SSNS 2012 Detailed Services PresentationSSNS 2012 Detailed Services Presentation
SSNS 2012 Detailed Services Presentation
 
10 fn s29
10 fn s2910 fn s29
10 fn s29
 
Mobile App Assurance: Yesterday, Today, and Tomorrow.
Mobile App Assurance: Yesterday, Today, and Tomorrow.Mobile App Assurance: Yesterday, Today, and Tomorrow.
Mobile App Assurance: Yesterday, Today, and Tomorrow.
 
Advancing the Traditional Enterprise: An EA Story
Advancing the Traditional Enterprise: An EA Story Advancing the Traditional Enterprise: An EA Story
Advancing the Traditional Enterprise: An EA Story
 
End-to-End and IPv6
End-to-End and IPv6End-to-End and IPv6
End-to-End and IPv6
 
Cradle Point Mbr900
Cradle Point Mbr900Cradle Point Mbr900
Cradle Point Mbr900
 

Similar a WebSocket - Enabling Technology for Dynamic Web Applications

MobiSys Group Presentation
MobiSys Group PresentationMobiSys Group Presentation
MobiSys Group PresentationNeal Lathia
 
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)Ari Zoldan
 
MIS Chapter 3
MIS Chapter 3MIS Chapter 3
MIS Chapter 3Lee Gomez
 
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)Wireless Sensor Networks Apellidos
 
First Operational Technology (OT) High Performance Messaging Patterns for Ent...
First Operational Technology (OT) High Performance Messaging Patterns for Ent...First Operational Technology (OT) High Performance Messaging Patterns for Ent...
First Operational Technology (OT) High Performance Messaging Patterns for Ent...Real-Time Innovations (RTI)
 
Geddes/PNSol - Broadband market evolution
Geddes/PNSol - Broadband market evolutionGeddes/PNSol - Broadband market evolution
Geddes/PNSol - Broadband market evolutionMartin Geddes
 
Wireless Broadband Delivers The 21st Century
Wireless Broadband Delivers The 21st CenturyWireless Broadband Delivers The 21st Century
Wireless Broadband Delivers The 21st Centuryandrescarvallo
 
Arch Rock Overview
Arch Rock OverviewArch Rock Overview
Arch Rock Overviewpauldeng
 
ITU-T Study Group 13 Introduction
ITU-T Study Group 13 IntroductionITU-T Study Group 13 Introduction
ITU-T Study Group 13 IntroductionITU
 
WTSA-16_SG13_Presentation.pptx
WTSA-16_SG13_Presentation.pptxWTSA-16_SG13_Presentation.pptx
WTSA-16_SG13_Presentation.pptxlionofsouth
 
Ngn2004 Moving Up And To The Edges110204
Ngn2004 Moving Up And To The Edges110204Ngn2004 Moving Up And To The Edges110204
Ngn2004 Moving Up And To The Edges110204guestf6c708
 
Embedded Devices on the Internet of Things
Embedded Devices on the Internet of ThingsEmbedded Devices on the Internet of Things
Embedded Devices on the Internet of Thingszdshelby
 
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...Nuage Networks
 
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...Nuage Networks
 
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best Practices
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best PracticesManaging the Mobile Device Wave for Enterpise Wireless Networks: Best Practices
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best PracticesCisco Mobility
 
Quality of service
Quality of serviceQuality of service
Quality of servicevmkris000
 

Similar a WebSocket - Enabling Technology for Dynamic Web Applications (20)

MobiSys Group Presentation
MobiSys Group PresentationMobiSys Group Presentation
MobiSys Group Presentation
 
Pervasive Computing
Pervasive ComputingPervasive Computing
Pervasive Computing
 
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)
NexAira Consumer Class 3G/4G Wireless Broadband Router (Quantum-Wireless.com)
 
Lecture03 H
Lecture03 HLecture03 H
Lecture03 H
 
NFV SDN for carriers
NFV SDN for carriersNFV SDN for carriers
NFV SDN for carriers
 
MIS Chapter 3
MIS Chapter 3MIS Chapter 3
MIS Chapter 3
 
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)
XBow: Wireless Sensor Networks in Industry by Alan Broad (CTO)
 
First Operational Technology (OT) High Performance Messaging Patterns for Ent...
First Operational Technology (OT) High Performance Messaging Patterns for Ent...First Operational Technology (OT) High Performance Messaging Patterns for Ent...
First Operational Technology (OT) High Performance Messaging Patterns for Ent...
 
Geddes/PNSol - Broadband market evolution
Geddes/PNSol - Broadband market evolutionGeddes/PNSol - Broadband market evolution
Geddes/PNSol - Broadband market evolution
 
Wireless Broadband Delivers The 21st Century
Wireless Broadband Delivers The 21st CenturyWireless Broadband Delivers The 21st Century
Wireless Broadband Delivers The 21st Century
 
Arch Rock Overview
Arch Rock OverviewArch Rock Overview
Arch Rock Overview
 
ITU-T Study Group 13 Introduction
ITU-T Study Group 13 IntroductionITU-T Study Group 13 Introduction
ITU-T Study Group 13 Introduction
 
WTSA-16_SG13_Presentation.pptx
WTSA-16_SG13_Presentation.pptxWTSA-16_SG13_Presentation.pptx
WTSA-16_SG13_Presentation.pptx
 
Ngn2004 Moving Up And To The Edges110204
Ngn2004 Moving Up And To The Edges110204Ngn2004 Moving Up And To The Edges110204
Ngn2004 Moving Up And To The Edges110204
 
Manika
ManikaManika
Manika
 
Embedded Devices on the Internet of Things
Embedded Devices on the Internet of ThingsEmbedded Devices on the Internet of Things
Embedded Devices on the Internet of Things
 
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...
Nuage Networks: Delivering Datacenter Networks As Consumable as Computee_scot...
 
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...
Nuage Networks: Gluecon 2013 Keynote: The True Potential of Network Virtualiz...
 
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best Practices
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best PracticesManaging the Mobile Device Wave for Enterpise Wireless Networks: Best Practices
Managing the Mobile Device Wave for Enterpise Wireless Networks: Best Practices
 
Quality of service
Quality of serviceQuality of service
Quality of service
 

Último

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 

Último (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 

WebSocket - Enabling Technology for Dynamic Web Applications

  • 1. Bergmans Mechatronics LLC HTML5 WebSocket - Enabling Technology for Dynamic W b A li i D i Web Applications John Bergmans Bergmans Mechatronics LLC www.bergmans.com HTML5 & CSS3 User Group LA Los Angeles, CA Jan 26 2011 1616 Bedford Lane, Unit A Phone: 714-474-8956 Newport Beach, CA 92660 Fax: 949-646-1429
  • 2. Bergmans Mechatronics LLC Speaker Intro • Operating Bergmans Mechatronics since 2003 • Real-time Web App researcher • Developer of data acquisition and control systems, using LabVIEW and C Rocket Motor Data Acquisition and Control Systems Ethernet Router Laptop LasIR Steel Ball Electromagnet g NH3 M it Monitor Laser Alignment System Processing Unit IR LED Port Photodiode Detector Port Laser-Based Laser Alignment Control System Technology Instrumentation System Demonstrator
  • 3. Bergmans Mechatronics LLC Generalized Technology Trends Distributed mainframes dumb terminals commodity servers desktops d kt laptops l t mobile bil ‘60s – ’70s ‘80s – ’90s today y Time workstations, desktops Standalone Fiber to Communications Home Speed S d DSL / cable (2+ Gbit/sec) (~10 Mbit/sec) Phone modem 0.300 0 300 – 56 kbit/sec Note: SATA 2.0 = 2 4 Gbit/s 2 0 2.4
  • 4. Bergmans Mechatronics LLC Generalized Technology Trends • Increasing communications speeds, low cost commodity servers, low-cost high performance “terminals” (Cloud access speed = local drive access speed) p promotes trend towards distributed, browser-based apps , pp (eg. Google Docs) • Limitation of legacy browsers - no TCP/IP socket connectivity g y y forces use of HTTP request/response • WebSockets • socket-like connectivity for browsers • enabling technology for distributed apps
  • 5. Bergmans Mechatronics LLC Overview • Review of current techniques for dynamic web applications • WebSocket introduction • WebSocket demonstration applications pp
  • 6. Bergmans Mechatronics LLC Polling Image Copyright © 2011 - Kaazing Corporation Used by Permission Corporation. Permission.
  • 7. Bergmans Mechatronics LLC Long Polling Image Copyright © 2011 - Kaazing Corporation Used by Permission Corporation. Permission.
  • 8. Bergmans Mechatronics LLC WebSocket • Enables continuous, bidirectional communications between browser and server • Specification defined by W3C (API) and IETF (protocol) • Simple browser and back-end implementation • Substantially reduced header info size (request and response: ~900 b t vs W bS k t 4 b t ) ( t d 900 bytes WebSocket: bytes)
  • 9. Bergmans Mechatronics LLC Browser/Back-End Communications Traditional interface between browser and web server 1) Data Request Web Server Back-End Browser 2) Reply Software Application Desktop D kt Server S
  • 10. Bergmans Mechatronics LLC Browser/Back-End Communications Traditional interface between browser and web server 1) Data Request Web Server Back-End Browser 2) Reply Software Application Desktop D kt Server S Continuous bi-directional communication between browser and server using WebSocket Data to Back-End App WebSocket Back-End Browser Data from Back-End App Server Application Desktop WebSocket Server
  • 11. Bergmans Mechatronics LLC Simple and Standardized API // Handler for Connect button connect.onclick = function() { websocket = new WebSocket(location_.value); websocket.onopen = function(evt) { log("CONNECTED"); connect.disabled = true; disconnect.disabled = false; send.disabled = false; } websocket.onmessage = function(evt) { response("RESPONSE: " + evt.data); } websocket.onclose = function(evt) { log("DISCONNECTED"); connect.disabled = false; disconnect.disabled = true; send.disabled = true; } }; // Handler for Send button send.onclick = function() { log("SENT: " + message.value); websocket.send(message.value); }; // Handler for Disconnect button disconnect.onclick = function() { websocket.close(); }; Code and Image Copyright © 2011 - Kaazing Corporation. Used by Permission.
  • 12. Bergmans Mechatronics LLC Wireshark Trace of Echo Demo Client to Server: GET /echo?.kl=Y HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: student1.html5project.com:8001 Origin: http://student1.html5project.com:8000 Sec-WebSocket-Key1: 255742716( |7 Sec-WebSocket-Key2: Lr C 45 7 9E52 %] 78;w qo4 Cookie: KSESSIONID=1kRqopFaGlLI6ioKPg5lj6I0gq+MT2TPo2gpKeqqeQm2bCcbesF+7A== i......K Server to Client: HTTP/1.1 101 Web Socket Protocol Handshake Upgrade: WebSocket Connection: Upgrade Sec-WebSocket-Origin: http://student1.html5project.com:8000 Sec-WebSocket-Location: ws://student1.html5project.com:8001/echo?.kl=Y Server: Kaazing Gateway Date: Mon, 24 Jan 2011 21:55:31 GMT Access-Control-Allow-Origin: http://student1.html5project.com:8000 Access-Control-Allow-Credentials: true .....w.......fw.....N. Client to Server: .Hello, WebSocket!. Server to Client: .Hello, WebSocket!. Copyright © 2011 - Kaazing Corporation. Used by Permission.
  • 13. Bergmans Mechatronics LLC WebSocket • Multiple organizations developing WebSocket servers System Developer em-websocket Ilya Grigorik of PostRank with other contributors jWebSocket jWebSocket.org Jetty W bS k t S J tt WebSocket Server Jetty J tt Kaazing WebSocket Gateway Kaazing Corp pywebsocket pywebsocket opensource project Pusher (based on em-websocket) New Bamboo Resin R i Caucho T h l C h Technology I Inc. • Kaazing Corp., Mountain View, CA ( g p, , (www.kaazing.com) g ) • Developer of commercial WebSocket gateway • Emulation for legacy and mobile browsers • User authorization • Secure WebSockets • Contributor to HTML5 spec • Disclosure: BML has referral agreement with and is contractor to Kaazing
  • 14. Bergmans Mechatronics LLC EarthControl – Multiplayer Facebook Game http://apps.facebook.com/earthcontrol
  • 15. Bergmans Mechatronics LLC Browser – Server Architecture for EarthControl Application Game 1 Browsers Game 2 Browsers Game n Browsers Browser Browser Browser Browser Browser Browser Browser Browser Browser 1 2 8 1 2 8 1 2 8 Kaazing WebSocket Gateway ActiveMQ Server EarthControl EarthControl EarthControl EarthControl Admin Game 1 Game 2 Game n Legend STOMP Message MySQL Query / Result MySQL Database Game Instance Linux Server Li S Initialization I iti li ti
  • 16. Bergmans Mechatronics LLC Performance • Typical server transmit rate to each browser: char string approximately 340 character in length at about 10 Hz ≈ 3400 bytes/sec • Latency between user input and display update: <~100 ms. • Kaazing’s WebSocket Emulation enables WebSocket capability on current non-HTML5 browsers • EarthControl functions well using these browsers • Google Chrome ( g (version 2.0 or later) ) • Safari (version 4.0 or later) • Firefox (version 3.0 or later) • Internet Explorer (version 7.0 or later)
  • 17. Bergmans Mechatronics LLC Browser - Server Interfacing (Steady State) Facebook iFrame iFrame EarthControl_client.html function setup() EarthControl.php E thC t l h { Topic “/topic/fromBrowserYY” (instance YY) user-initiated events trigger Data ship_index, keypress data, etc stomp.send() Real-time game g Topic ” /topic/toBrowserXX_YY” support for Data display data game YY stomp.onmessage() { update display } } XX = ship index number Server YY = game id number Browser
  • 18. Bergmans Mechatronics LLC Browser - Server Interfacing (including Handshaking) Facebook iFrame EarthControl.php iFrame UID = User ID number XX = ship index number $facebook->api_client-> EarthControl_client.html YY = game id number g users_getInfo; users getInfo; function pre_setup() function user info { handleResponse() handleResponse() EarthControl_Admin.php } Subscribe to topic function setup() Topic “/topic/fromBrowser_Admin” “/topic/fromBrowser_Admin” { D t user i f (name, UID, etc) Data info ( UID t ) pre_setup() - Query SQL database stomp.onopen() - Assign game and { Topic “/topic/toBrowser_Admin_UID” ship_index • subscribe to topic “/topic/toBrowser_Admin_UID” Data game_id, ship_index - Start new game instance • send user info (if necessary) } stomp onmessage() { EarthControl.php if handshaking (instance YY) • subscribe to top c subsc be topic Topic “/topic/fromBrowserYY” /topic/fromBrowserYY “/topic/toBrowserXX_YY” Subscribe to topic Data ship_index, “new_player” signal • send user info “/topic/fromBrowserYY” else Handshaking Topic “/topic/toBrowserXX_YY” • normal data Data field data processing Real-time game support for game YY } Topic “/topic/fromBrowserYY” Data ship_index, keypress data, etc • user-initiated gui events • stomp.connect() } Browser Server
  • 19. Bergmans Mechatronics LLC Cloud Server Monitor • Monitor server performance without browser polling • Provides output of “top” and “vmstat” to browser. • Update rates: • top: 2 Hz • vmstat: 1 Hz • Plots “top” output in HTML5 <canvas> element top • Idea for future work: • Monitor and control of multiple servers Browser on Desktop or Mobile Device Data transfer D t t f via WebSocket WebSocket Message Monitor Gateway Broker Agent Server
  • 21. Bergmans Mechatronics LLC Remote Access to LabVIEW Application • Goal: monitor and control a LabVIEW application using a plug-in-free browser LabVIEW Browser on Application Laptop, Desktop or Desktop / Mobile Device Embedded Device • Potential Use-Cases • Monitor and control a LabVIEW-controlled lab test from the desktop in office or on the road using a mobile device • Monitor large-scale LabVIEW application by crews in the field – ie oil rig equipment monitoring i t it i • For low-cost embedded systems – eliminate physical UI by using browser to interface to device
  • 22. Bergmans Mechatronics LLC “LabSocket” = LabVIEW + WebSocket LabSocket system uses WebSockets to enable automatic replication of LabVIEW front panel in a browser without plug-ins LabSocket Message WebSocket Interface I t f Broker B k Gateway G t LabVIEW Data transfer Data transfer Application via Server Browser on via TCP/IP Socket Desktop or WebSocket Desktop / Mobile Device Embedded Device
  • 23. Bergmans Mechatronics LLC “LabSocket” = LabVIEW + WebSocket LabSocket system uses WebSockets to enable automatic replication of LabVIEW front panel in a browser without plug-ins LabSocket Message WebSocket Interface I t f Broker B k Gateway G t LabVIEW Data transfer Data transfer Application via Server Browser on via TCP/IP Socket Desktop or WebSocket Desktop / Mobile Device Embedded Device LabSocket Interface Startup - Establish TCP/IP socket connection to message broker - LabVIEW Front Panel Screen Scrape, send JavaScript code to web server Steady-state - Transmit updates in LabVIEW front panel to browser -U d Update L bVIEW f LabVIEW front panel b l based on events generated i b d d in browser
  • 24. Bergmans Mechatronics LLC “LabSocket” = LabVIEW + WebSocket • Video: http://screencast.com/t/eKuQ02PAdo LabVIEW Browser
  • 25. Bergmans Mechatronics LLC Screenscrape SubVI Label for one LED
  • 26. Bergmans Mechatronics LLC WebSocket as Alternative to HTTP Request-Response • Initial investigation into use of WebSocket to improve performance of HTTP- based phpMyAdmin
  • 27. Bergmans Mechatronics LLC WebSocket as Potential Alternative to HTTP Request-Response phpMyAdmin – Popular MySQL Interface “Navigation” Frame “Content” Frame Hyperlink in HTML code for this single GUI element
  • 28. Bergmans Mechatronics LLC phpMyAdmin – How It Works Browser Server 1. User clicks on hyperlink in GUI 2. JavaScript creates http htt request t http request for updated frame: http://sql.php?db=...&table=...&sql_query=...&token=... 3. Confirm that this is an authentic request 4. Process MySQL query 5. Generate new Content frame with http requests in hyperlinks for each active element (including all MySQL html code for new frame which includes queries) for every GUI element: p q p p q _q y http://sql.php?db=...&table=...&sql_query=...&token=... 6. Send new html code for f f frame to browser b 7. Render page
  • 29. Bergmans Mechatronics LLC WebSocket-MyAdmin – Simplified WebSocket-based MySQL Interface • Objective: To illustrate performance improvements available by using WebSocket HTML for this element Event handlers are programmatically assigned to each active GUI element in client-side JavaScript. eg. Columns heading event handlers are assigned using: If “col1” is pressed client sends to server via WebSocket: “col_heading,col1”
  • 30. Bergmans Mechatronics LLC WebSocket-MyAdmin – How it Works Browser Server 1. User action within GUI creates an event 2. Event handler creates event notification message Signal representing required action, eg: “col_heading,col1” 3. Create MySQL query for this action 4. Process MySQL query 5. Generate new GUI elements and events Browser control signals and data 1. del_html, 6. Send GUI elements and 2. add_html,<table><tr><td> …. events to browser </td></tr></table> 3. add_column_event,col0… 7. Delete existing Note: In current demo, html code table and events for entire table are sent from server to browser. A 8. Create new table more refined approach would be 9. Create new event WebSocket to update only those elements Connection which have changed. handlers
  • 31. Bergmans Mechatronics LLC Test Results Testing two cases for WebSocket configuration (with and without element events) and phpMyAdmin. In all cases – column sort of 10x10 matrix • WebSocket interface was always faster • Relative to phpMyAdmin more data transferred with element events, slightly less t l transferred without element events (Note – phpMyAdmin d f d ith t l t t (N t h M Ad i does not allow i t ll in- table element editing) Number of packets Number of bytes Update time (sec) phpMy WS- phpMy WS- phpMy WS- Admin MyAdmin Admin MyAdmin Admin MyAdmin with no with no with no element element element element element element events events events events events events Browser to Server Server to Browser Total 35 48 16 11901 36773 8638 1.16 0.53 0.43
  • 32. Bergmans Mechatronics LLC Future Work • LabVIEW Cloud service • Allow LabVIEW developers to automatically set up applications • Subscription set up p p • Improved GUI element support • Development of Demo Apps / Custom Applications p pp pp • Research • Investigation in other applications for WebSocket • Further comparisons of WebSockets to HTTP