WebSocket Perspectives and Vision for the Future

  • 6,460 views
Uploaded on

HTML5DevConf 2013 presentation in San Francisco

HTML5DevConf 2013 presentation in San Francisco

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Updated version: http://www.slideshare.net/grecof/web-socketperspectives-oct2013
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
6,460
On Slideshare
0
From Embeds
0
Number of Embeds
6

Actions

Shares
Downloads
46
Comments
1
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Frank Greco - @frankgrecoDirector of Technology, KaazingWebSocket PerspectivesandVision for the Future
  • 2. © 2013 Kaazing Corporation§  Brief Background on WebSocket§  What Really is WebSocket and What it is Not§  Layered Approach to Web Protocols§  The Web beyond the Browser - XaaS§  Use Cases and DemosOutline
  • 3. © 2013 Kaazing CorporationMe…§  Director of Technology @ Kaazing§  Chairman NYJavaSIG (javasig.com)§  Largest Java UG in North America7,500+ members§  Chair NYHTML5§  Email: frank.greco@kaazing.com§  Twitter: @frankgreco§  Yell: “Hey Frank!”
  • 4. © 2013 Kaazing CorporationWelcome HTML5 (aka The New Web)§  Users are Demanding more from Apps§  UI/UX Requirements are more sophisticated§  Browser Enhancements and Evolution§  API Explosion§  Web no longer just about Documents… even partial orpseudo documentsThe New Web is a Programmatic Foundation for Rich,Reliable and Really Cool Apps
  • 5. © 2013 Kaazing CorporationWelcome HTML5 (aka The New Web)§  Users are Demanding more from Apps§  UI/UX Requirements are more sophisticated§  Browser Enhancements and Evolution§  API Explosion§  Web no longer just about Documents… even partial orpseudo documentsThe New Web is a Programmatic Foundation for Rich,Reliable and Really Cool AppsBut…
  • 6. © 2013 Kaazing Corporation§  Designed for document transfer – HTTP-  Short-lived Request / Response interaction§  Bidirectional, but half-duplex-  Traffic flows in only one direction at a time§  Stateless-  Large amounts of metadata resent for each requestWe Live in a Real-Time World… HTTP?Yes, HTTP 2.0 will be better, but theWeb was not originally designed for“real-time”, event-based services…
  • 7. © 2013 Kaazing CorporationSome things age well…TCPHTTP
  • 8. © 2013 Kaazing Corporation…and some things don’tOldies Hits - AJAX and the Comet Pollers - 2006
  • 9. © 2013 Kaazing CorporationWebSocket•  “Real-Time”, bi-directional connectivity•  IETF Protocol - RFC 6455 – Dec 2011•  W3C API•  Easily add event-based capability to web apps•  Avoids polling (and resource consumption)•  Avoids HTTP meta-data overhead•  Shares port with HTTP (80/443)•  Peer protocol to HTTP (both use TCP)
  • 10. © 2013 Kaazing Corporation§  IETF Formal Protocol (RFC 6455)-  Event-driven JavaScript API-  Full-duplex communication protocol§  W3C API – Candidate Recommendation-  http://www.w3.org/TR/websockets/§  Integrates HTTP addressing-  ws://yourcompany.com/collaboration_svc-  wss://anothercompany.com/marketdata_svc§  Traverses firewalls, proxies, routers securely§  Text and Binary§  Leverages Cross-Origin Resource Sharing (CORS)WebSocket Standards
  • 11. © 2013 Kaazing CorporationBut Why WebSocket?It’s the Most Important API in HTML5!•  Facilitates other protocols•  Puts the web in a better place…“Connectedness” – Always On… not partially on.Connect to People, Services, Work, Play, Buying/Selling,Collaboration, Entertainment, Navigation, Music, Politics,Philosophy, Devices, etc, etc, etc…
  • 12. © 2013 Kaazing CorporationThe WebSocket Handshake
  • 13. © 2013 Kaazing CorporationWebSocket Frames§  Frames have a few header bytes§  Data may be text or binary§  Frames from client to server are masked(XORed w/ random value) to avoid black hats with old proxies§  Use TLS in production – avoids a lot of issues…
  • 14. © 2013 Kaazing CorporationJava API for WebSocket - JSR 356§  Creation of WebSocket Java components tohandle bi-directional WebSocket conversations§  Handling WebSocket events§  Creation and consumption of WebSocket text andbinary messages§  Allows for WebSocket protocols and contentmodels for an application§  Configuration and management of WebSocketsessions, like timeouts, retries, cookies,connection pooling§  Specification of how WebSocket application willwork within the Java EE security model!§  Official Java SE WebSocket API in the works…
  • 15. © 2013 Kaazing CorporationWhat WebSocket is Not•  It is not a New AJAXAJAX was a lovable hack•  It is not a Push mechanismWebSocket is full-duplex, bi-directional•  It is not a Messaging systemIt’s an agnostic wire protocolIt’s a low-level transport API•  It is not a Replacement for HTTPHTTP is still great for static,cacheable info
  • 16. © 2013 Kaazing CorporationLegacy HTTP vs WebSocketFor Real-Time, Event-based Web Communication…Seems like a no-brainer for most apps…
  • 17. © 2013 Kaazing CorporationHTML5 WebSocket APIMake sure WS is openbefore usage… J
  • 18. © 2013 Kaazing CorporationHTML5 WebSocket APIDealing with WebSocket is like dealing with TCP.It’s a streams-based model. You need to understand howto handle streams-based data over the wire.e.g., How do I do publish/subscribe?But…
  • 19. © 2013 Kaazing CorporationWhat is Missing?Where is the Application-level Protocol?•  Who handles retries?•  How do we handle publish/subscribe semantics?•  How do we handle market data, last value cached, ?•  Is guaranteed delivery possible (trades)?•  What if the client is not active?•  How do we handle [fill in with favorite semantics]•  What about partials?•  Who’s responsible for entitlements? How do Imanage that?•  etc…
  • 20. © 2013 Kaazing CorporationWebSocketTCPJMS XMPP AMQP B2B FTP VNC mktdata etcBrowser and Native ApplicationsWebSocketGatewayInternetWebSocketGatewayWhoa… Its just like TCP! Huzzah!But wait… Protocol Layering is Possible!
  • 21. © 2013 Kaazing CorporationAnything Else Missing?Other Considerations for the Real-World…•  Need to handle multiple WS versions•  Need to handle multiple (and legacy) browser versions•  Can’t have business logic in the DMZ•  Have to work in multiple DMZs•  AuthN/AuthZ has to work multiple times•  High-availability topology•  Concerns about open ports with back-end service•  Services architecture needs to be consistent•  Native, HTML5 and hybrid environments•  Integrate easily with non-messaging services•  XaaS integration – the Web beyond the browser•  Bandwidth management•  etc… All things you need for a real enterprise app
  • 22. © 2013 Kaazing CorporationPublish/Subscribe over the Web – an ExampleJava Message Service (JMS)overWebSocketA 60-second TutorialIn case you haven’t heard of JMS…Messaging more resilient than RPC point-to-point, especially for composite services.Many companies rely on ESBs
  • 23. © 2013 Kaazing CorporationJava Message Service (JMS)•  Java EE Message Oriented Middleware•  JMS 1.0 2001, JMS 1.1 2002, JMS 2.0 (Feb 26, 2013)•  Asynchronous Messaging vs. RPC•  Loosely coupled vs. Tightly coupled•  Pub/Sub, Topics, Queues•  Transactions, Reliable
  • 24. © 2013 Kaazing CorporationBasic Inside-the-Firewall JMS (Java to Java)conn = createConnection();sess = conn.createSession();topic = jndiContext.lookup(topic);pub = sess.createProducer(topic);pub.send(“hey Frank”);conn = createConnection();sess = conn.createSession();topic = jndiContext.lookup(topic);sub = sess.createConsumer(topic);sub.setMessageListener(this);…public void onMessage(Message m) {String s = m.getText();… do stuff…}conn = createConnection();sess = conn.createSession();topic = jndiContext.lookup(topic);sub = sess.createConsumer(topic);sub.setMessageListener(this);…public void onMessage(Message m) {String s = m.getText();… do stuff…}conn = createConnection();sess = conn.createSession();topic = jndiContext.lookup(topic);sub = sess.createConsumer(topic);sub.setMessageListener(this);…public void onMessage(Message m) {String s = m.getText();… do stuff…}msgbroker
  • 25. © 2013 Kaazing CorporationNow… JMS API for JavaScript - exampleconnFactory = new StompConnectionFactory(…url…);connection = connFactory.createConnection(…)session = connection.createSession(…);var myTopic = session.createTopic("/topic/myTopic");topicProducer = session.createProducer(myTopic);topicConsumer = session.createConsumer(myTopic);topicConsumer.setMessageListener(onMessage);1234567
  • 26. © 2013 Kaazing CorporationJMS API for JavaScript8.  Send messages9.  Process messages: the message listenerfunction: onMessage()var onMessage = function(message) {if (message.getStringProperty(MESSAGE_PROPERTIES.userId) != userId) {$("#slider").val(message.getText());$("#pic").width(message.getText());}};var doSend = function(message) {message.setStringProperty(MESSAGE_PROPERTIES.userId, userId);topicProducer.send(null, message, DeliveryMode.NON_PERSISTENT, 3, 1, function()sendFromQueue();});};
  • 27. © 2013 Kaazing CorporationHigher Level APIs (over WebSocket) for JavaScriptSo if you can layer application protocols and APIs overWebSocket, what do you have?•  Easier WebSocket programmability•  Event-driven applications over the web•  Event-driven APIs over the web•  Not necessary to open non-standard ports•  Web infrastructure now truly “disappears”•  Reduction in complexity•  Further opportunities to innovate•  Mobile + cloud + HTML5/WebSocket•  Internet/Web of Things•  New world awaits!
  • 28. © 2013 Kaazing CorporationWebSocket Projects, OSS, Vendors•  Kaazing•  Node.js/socket.io/SockJS/engine.io•  ActiveMQ•  Tomcat•  Jetty•  Oracle Glassfish•  Java EE – JSR 356•  Play Framework•  Rabbit MQ•  JBoss•  IIS/ASP .NET 4.5•  PHP, Objective-C, Ruby, Python, C/C++, JVM-langs…•  Many more…
  • 29. © 2013 Kaazing CorporationWebSocket Examples
  • 30. © 2013 Kaazing CorporationFuturesWhat’s next for WebSocket?
  • 31. © 2013 Kaazing CorporationNew Computing ModelCloudsA Mobile App is easier to port to DesktopA Desktop App is a challenge to port to Mobile
  • 32. © 2013 Kaazing CorporationIndustry View of Cloud StackHardwareInfrastructure as a ServiceIaaSPlatform as a ServicePaaSSoftware as a ServiceSaaS
  • 33. © 2013 Kaazing CorporationMore Accurate View - Cloud Services StackHardwareCompute/Network/StorageDevelopment, Delivery,Management, Security,Messaging, Integration, Testing,…Applications
  • 34. © 2013 Kaazing CorporationWeb APIs§  APIs from everywhere§  Over 9,000 public APIs and even more Mashups-  programmableweb.com/apis/directory-  Amazon, Facebook, LinkedIn, AT&T, Google, Microsoft,NYTimes, Orange, SalesForce, Telefonica, Twitter, Visa,Vodafone, Yandex§  Enterprise and B2B APIs§  Over time, more will be event-based – NoREST?§  Services… Services… Services…
  • 35. © 2013 Kaazing CorporationOpen APIsMost PopularGoogle Maps, Twitter, YouTube, Flickr, Amazon eCommerce, Facebook, Twilio, …
  • 36. © 2013 Kaazing CorporationEvent-based XaaSMonitoring as a ServiceIntegration as a ServiceEnterprise Messagingas a ServiceWAN Optimization as a ServiceGovernance as a ServiceDatabase as a ServiceAnalytics as a ServiceEAI as a ServiceCDN as a ServiceTrade Clearance as aServiceWindows Desktopas a ServiceSentiment Analysisas a ServiceAuditing as aServiceTelephony as aServiceData Center as a ServiceNetwork as a ServiceRisk Analyticsas a ServiceBackupas a ServiceSecurity as a ServiceNotification as a ServiceIdentity as a ServiceTesting as aService
  • 37. © 2013 Kaazing CorporationNew Computing ModelCloudCloudPub/SubCloudEnterpriseStorageNotificationsTransactionsMonitoringEmail DocsCloud VNCDesktopCloud Cloud SentimentAnalysisRiskManagementwebsocketwebsocketwebsocketwebsocketwebsocketWealth ManagementCollaboration
  • 38. © 2013 Kaazing CorporationInter-Cloud ConnectivityEnterpriseserviceEnterprise Service Busservice serviceExternal CloudService Busservice service serviceiPaaSInternet Service BuswebsocketwebsocketSentiment Analysisas a ServiceRisk Managementas a ServiceComplianceas a ServiceTelemetry Aggregationas a Service
  • 39. © 2013 Kaazing CorporationOther Interesting Directions….•  HTTP 2.0 and WebSocket•  WebSocket extensions: compression, mux, etc•  TCP <-> WebSocket <-Net-> WebSocket <-> TCP•  Embedded WebSocket (telecom, tv, car, etc)•  WebRTC signaling, etc•  MMO Gaming•  Big Data event processing (risk management, et al)•  Real-time Ad exchanges•  More types of cloud services – Real time XaaS•  Internet/Web of Things
  • 40. © 2013 Kaazing CorporationUse Cases and DemosPeter Moskovitspeter.moskovits@kaazing.com, @pmoskovi
  • 41. © 2013 Kaazing CorporationWeb Trading SystemsFX Trader Application – front officedemo.kaazing.com/forexHigh msg rate, small payload requirements…
  • 42. © 2013 Kaazing CorporationMobile Mobile Computingdemo.kaazing.com/racer
  • 43. © 2013 Kaazing CorporationPrezing – Web-Collaborative Presentation Tool
  • 44. © 2013 Kaazing CorporationLabView UI replicated to Browser in Real-timeData Acquisition – courtesy of Bergmans MechatronicsLabView browser
  • 45. © 2013 Kaazing CorporationMonster Truck as a Servicegithub.com/dpwspoon/kaazingPiControlling an RC carremotely via Web Messaging!
  • 46. © 2013 Kaazing CorporationQuestions?frank.greco@kaazing.com