Upload
others
View
15
Download
0
Embed Size (px)
Citation preview
1! Copyright © 2012 – Kaazing Corporation
Extending JMS over the Web with HTML5 WebSocket
2! Copyright © 2012 – Kaazing Corporation
What we are going to cover…
• Quick Overview of HTML5 • What is a WebSocket? • Very Quick Review of JMS • Extending JMS over the Web • How to Become Famous, Gain Wealth, Have 1M+ FB Friends and be an Overall AwesomePerson™
3! Copyright © 2012 – Kaazing Corporation
First of all…
Overview of HTML5
4! Copyright © 2012 – Kaazing Corporation
• Focused on Web Applications
• Web apps are rapidly becoming first class apps, on par with desktop and native apps
• Collection of Technologies
• Not just an upgrade to HTML4
What is “HTML5”?
5! Copyright © 2012 – Kaazing Corporation
Why HTML5?
• Users are Demanding more from Apps • UI/UX Requirements are more sophisticated • API Explosion • Browser Enhancements • The Web is No Longer Just About Documents but the
Existing Infrastructure Reflects this Legacy
• HTML5 is the next Phase of the Web • “HTML5” is a Programmatic Foundation for Apps • Collection of Technologies
6! Copyright © 2012 – Kaazing Corporation
HTML5 Feature Areas
7! Copyright © 2012 – Kaazing Corporation
Connectivity Features
• Cross Document Messaging • XMLHttpRequest Level 2 • Server-Sent Events • WebSocket • CORS
8! Copyright © 2012 – Kaazing Corporation
New Technology
What is a WebSocket?
9! Copyright © 2012 – Kaazing Corporation
Legacy Web Stack
• Designed to serve static documents • HTTP • Half duplex communication
• High latency • Bandwidth intensive
• HTTP header traffic approx. 800 to 2000 bytes overhead per request/response
• Complex architecture • Not changed since the 90’s • Plug-ins • Polling / long polling • Legacy application servers
• Expensive to scale applications Half duplex Full duplex
10! Copyright © 2012 – Kaazing Corporation 4/20/12 10
Protocol mismatches… Inefficient…
Scalability Issues…
Latency Issues…
Middleware for the Middleware…
11! Copyright © 2012 – Kaazing Corporation 4/20/12 11
Scalability
Growth
Complexity
Simple stuff scales… Complexity doesn’t
Greco’s Law!Scalability = Growth / Complexity
12! Copyright © 2012 – Kaazing Corporation
• Designed for document transfer • Resource addressing • Request / Response interaction • Caching
• Bidirectional, but half-duplex • Traffic flows in only one direction at a time
• Stateless • Header (metadata) info resent for each request
HTTP Characteristics
13! Copyright © 2012 – Kaazing Corporation
WebSocket
• New W3C API and IETF Protocol for low-latency, real-time, bi-directional connections
• RFC 6455 – Dec 2011 • Easily add event-based data to web applications • Avoids polling • Avoids HTTP meta-data overhead
14! Copyright © 2012 – Kaazing Corporation
WebSocket
• Includes W3C API and IETF Protocol (RFC 6455) • Event-driven JavaScript API • Full-duplex communication protocol
• Integrates HTTP addressing • ws://yourcompany.com:80/tcp-for-the-web • wss://anothercompany.com/marketdata_svc
• Traverses firewalls, proxies, routers • Leverages Cross-Origin Resource Sharing (CORS)
• http://www.w3.org/TR/access-control/
• Allows unlimited connections per Origin
15! Copyright © 2012 – Kaazing Corporation
Living Web Stack
• Designed for full-duplex high performance transactional Web • HTTP & HTML5 WebSocket • Full duplex communication
• Lower latency • Reduced bandwidth • Simplified architecture • Massive scalability
Half duplex Full duplex
16! Copyright © 2012 – Kaazing Corporation
WebSocket Handshake
17! Copyright © 2012 – Kaazing Corporation
WebSocket 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 confusing proxies
18! Copyright © 2012 – Kaazing Corporation
Stuff we should know already
Oh yeah… JMS
19! Copyright © 2012 – Kaazing Corporation
Java Messaging Service
• Message Oriented Middleware • Part of Java EE • JMS 1.0 2001, JMS 1.1 2002, JMS 2.0 2013
(projected) • Asynchronous Messaging vs RPC • Loosely coupled vs Tightly coupled • Pub/Sub, Topics, Queues • Transactions, Reliable
20! Copyright © 2012 – Kaazing Corporation
Basic JMS
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… }
msg broker
21! Copyright © 2012 – Kaazing Corporation
The Cool Part of Frank’s talk
Extending JMS over
the Web
22! Copyright © 2012 – Kaazing Corporation 4/20/12 22
WebSocket
TCP
JMS XMPP AMQP B2B FTP VNC mktdata etc
Browser and Native Applications
WebSocket Server
Internet
WebSocket Server
Protocol Layering
23! Copyright © 2012 – Kaazing Corporation
Back-end server
Browser
WebSocket
JMS Over WebSocket
24! Copyright © 2012 – Kaazing Corporation
Back-end server
Browser
WebSocket
JMS Over WebSocket
JMS
Back-end server
Browser
WebSocket
25! Copyright © 2012 – Kaazing Corporation
J2EE Applica+on Server
Why JMS over WebSocket?
Message Broker (JMS Provider)
JMS Web Container
SOAP over HTTP Web
Service
JSP
Firewall
Typical Current JMS Architecture
HTTP
JMS Over WebSocket
Firewall
EJB Container
EJB
WEB
New WebSocket-based Architecture
26! Copyright © 2012 – Kaazing Corporation
Server Support – JMS or WS
• Kaazing WebSocket Gateway • ActiveMQ • Apache mod_pywebsocket • Jetty • phpwebsockets • web-socket-ruby • Yaws (Erlang) • Node.js • And more…
27! Copyright © 2012 – Kaazing Corporation
Web Applications Now Change
Now we have reliable, secure real-time communications.
Not just broadcast (simple push), but bidirectional
communications for mobile and the desktop.
Examples: • Financial Services • Ecommerce, Retail • Multi-player Gaming
• Telecom • Embedded Devices • IPtv, cars, entertainment,
collaboration, et al…
28! Copyright © 2012 – Kaazing Corporation
Copyright © 2010, Kaazing Corporation,. All rights reserved.
Kaazing Internals
WebSocket Gateway
• async IO • we don’t hold on to objects • minimize latency • minimal threading/GC • staged event-driven arch • JAAS, SSO, Kerberos, etc…
JMS ws
JMS
JMS
JMS
JMS
JMS
29! Copyright © 2012 – Kaazing Corporation
Virtual Private Connection
Client and Server are now proxied over the web with no code changes
30! Copyright © 2012 – Kaazing Corporation
Net
Msg Broker
Pricing Feeds
News/Alerts
Trade Exec
Reports
Mobile Browser/Native Client
Desktop Java/.NET
Browser Javascript/Flash/Java/Silverlight
Kaazing Gateway Cluster + Load Balancer
JMS, AMQP,
etc
Authentication Authorization
Other TCP/UDP protocols
Trading Services Architecture
31! Copyright © 2012 – Kaazing Corporation
Possibilities…
• Financial and trading apps • Online gaming and live auctions • BigData analytics • Performance and monitoring dashboards • RFID and GPS Tracking • Sports and news broadcasting applications • Supply chain and inventory management • Transportation logistics • Smart meters, embedded • Next generation web application of your
choice!
32! Copyright © 2012 – Kaazing Corporation
Financial Apps
http://demo.kaazing.com/portfolio
http://demo.kaazing.com/forex
33! Copyright © 2012 – Kaazing Corporation
Gaming
http://code.google.com/p/quake2-gwt-port
34! Copyright © 2012 – Kaazing Corporation
Data Acquisition
http://bergmans.com/downloads.html
LabSocket Extend LabVIEW applications to the browser