messaging over the web with websocket & jms · 2012-08-14 · websocket is two standards...
TRANSCRIPT
![Page 1: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/1.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 1
High Performance
Creators of HTML5 WebSocket
Enterprise Support
WebSocket Gateway
Messaging over the Web with WebSocket & JMS
Robin Zimmermann Product Manager Kaazing
![Page 2: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/2.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 2
The Challenge
Unlock data from the enterprise
Message Broker / Bus
Database
Proprietary Server
Browser
Mobile
Tablet
Desktop
Enterprise
Web
![Page 3: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/3.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 3
Messaging Over the Web
Everybody wants it Enterprises have had it a long time
• But locked up in the enterprise
Web developers are new to it Many applications and open-source projects
do their own kind of pub-sub JMS is richer JMS is standard
![Page 4: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/4.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 4
Architecture
JMS Client
Web Trusted Network
Application Server / Container
Traditional application server or container approach
![Page 5: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/5.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 5
Architecture
JMS Client
Web Trusted Network
Application Server / Container
HTTP is half-duplex
JMS TCP
HTTP TCP
![Page 6: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/6.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 6
Architecture
JMS Client
Web Trusted Network
Application Server / Container
HTTP is half-duplex
JMS TCP
HTTP TCP
![Page 7: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/7.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 7
Architecture
It's all HTTP: SOAP REST JSP, ASP Servlets And so on...
JMS Client
Web Trusted Network
Application Server / Container
HTTP is half-duplex
JMS TCP
HTTP TCP
![Page 8: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/8.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 8
Limitations of HTTP
Designed for static document retrieval • HTML files, Images, CSS files, JavaScript files
Half-duplex • High latency
High Bandwidth • Headers • Cookies
Stateless
![Page 9: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/9.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 9
Workarounds for HTTP Limitations
Ajax Polling Long Polling Hanging GET Comet
Not true real time End users don't see the pain, but developers
and systems administrators do
![Page 10: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/10.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 10
Overhead
Example:
Type one character: ~1500 characters exchanged
![Page 11: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/11.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 11
HTTP Request Headers
GET /PollingStock//PollingStock HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://localhost:8080/PollingStock/ Cookie: showInheritedConstant=false; showInheritedProtectedConstant=false; showInheritedProperty=false; showInheritedProtectedProperty=false; showInheritedMethod=false; showInheritedProtectedMethod=false; showInheritedEvent=false; showInheritedStyle=false; showInheritedEffect=false;
Client
![Page 12: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/12.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 12
HTTP Response Headers
Total overhead: 871 bytes (example) Often 1.5K+ bytes (for example, cookie data) Overhead is expensive
HTTP/1.x 200 OK X-Powered-By: Servlet/2.5 Server: Sun Java System Application Server 9.1_02 Content-Type: text/html;charset=UTF-8 Content-Length: 321 Date: Sat, 07 Nov 2009 00:32:46 GMT
Server
![Page 13: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/13.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 13
WebSocket
![Page 14: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/14.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 14
WebSocket is Two Standards
WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)
Standards Body: W3C Status: Draft
• Browser vendors • WebSocket server vendors
• Application developers
![Page 15: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/15.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 15
What is WebSocket?
Full-duplex TCP connection Low latency Low bandwidth
• Small number of fixed bytes per frame
Port 80/443 compatible Simple socket-like API
• Send messages • Event handler to receive messages
![Page 16: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/16.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 16
HTTP and WebSocket Work Together
![Page 17: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/17.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 17
HTTP and WebSocket Work Together
HTTP for static content
WebSocket for dynamic content
![Page 18: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/18.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 18
HTTP and WebSocket Work Together
WebSocket Gateway /
Server
Web Server / Cache Edge Network
HTTP HTTP
WebSocket
![Page 19: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/19.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 19
Architecture
JMS Client
Application Server / Container
Traditional application server or container approach
![Page 20: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/20.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 20
JMS Client
Architecture
JMS Client
Application Server / Container
Gateway architecture
WebSocket Gateway
![Page 21: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/21.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 21
JMS Client
Architecture
JMS Client
Application Server / Container
Not an application server or container
WebSocket Gateway
No code
![Page 22: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/22.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 22
Architecture
Client
Client
JMS
Application Server / Container
JMS JMS
HTTP
End-to-end protocol
WebSocket Gateway
JMS
![Page 23: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/23.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 23
Architecture
Client
Client
JMS TCP
Application Server / Container
JMS WS
JMS TCP
HTTP TCP
JMS
WebSocket Gateway
End-to-end protocol
![Page 24: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/24.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 24
Architecture
Client
Client Enterprise
Clients
JMS TCP
JMS TCP
Application Server / Container
JMS WS
JMS TCP
HTTP TCP
JMS
WebSocket Gateway
All clients are true JMS clients
![Page 25: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/25.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 25
Architecture
Client
Client Enterprise
Clients
JMS TCP
JMS TCP
Application Server / Container
JMS WS
JMS TCP
HTTP TCP
JMS
WebSocket Gateway
Clients are true JMS clients
createConnection(); session.createConsumer(); messageProducer.send();
createConnection(); session.createConsumer(); messageProducer.send();
![Page 26: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/26.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 26
Connectivity Logical versus physical connections
Web
FTP Server
Browser
FTP Client
![Page 27: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/27.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 27
Connectivity Logical versus physical connections
Web
FTP Server
Browser
FTP Client
![Page 28: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/28.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 28
Web
Connectivity Logical versus physical connections
Web
FTP Server
Browser
FTP Client
![Page 29: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/29.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 29
Architecture
Client
Client Enterprise
Clients
JMS
Application Server / Container
A Gateway architecture makes Web clients first-class citizens
JMS
WS
JMS
TCP
JMS
JMS HTTP
WebSocket Gateway
![Page 30: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/30.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 30
Architecture
Client
Client Enterprise
Clients
Application Server / Container
A Gateway architecture makes Web clients first-class citizens
JMS
JMS
JMS
JMS HTTP
![Page 31: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/31.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 31
Architecture
Client
Client Enterprise
Clients
JMS TCP
JMS TCP
Application Server / Container
HTTP TCP
JMS client library
JMS
JMS WS
JMS TCP WebSocket
Gateway
![Page 32: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/32.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 32
Architecture
Client
Client Enterprise
Clients
JMS TCP
JMS TCP
Application Server / Container
HTTP TCP
JMS client library
JMS
JMS WS
JMS TCP WebSocket
Gateway
• Standard JMS 1.1 API • Guaranteed, reliable delivery
![Page 33: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/33.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 33
Fan-out
Application Server/ Container
Publish once, deliver N times
WebSocket Gateway
JMS
![Page 34: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/34.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 34
Fan-out
Application Server/ Container
Increase clients to Web scale with no extra pressure on the back-end
WebSocket Gateway
JMS
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99
NAME AAPL
BUY 550.97
SELL 550.99 NAME AAPL
BUY 550.97
SELL 550.99 NAME AAPL
BUY 550.97
SELL 550.99 NAME AAPL
BUY 550.97
SELL 550.99 NAME AAPL
BUY 550.97
SELL 550.99
Pricing Engine
![Page 35: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/35.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 35
Application Logic
Client
Client
Application Server / Container
HTTP TCP
Back-end clients, systems, and services
JMS WS WebSocket
Gateway
Order System
Fulfillment
JMS
Trading Engine
CRM
![Page 36: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/36.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 36
Application Logic
Client
Client
Application Server / Container
HTTP TCP
Add services as required
JMS WS WebSocket
Gateway
Order System
Fulfillment
JMS
Trading Engine
Persistence
CRM
![Page 37: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/37.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 37
Application Logic
Client
Client
Application Server / Container
HTTP TCP
Add services as required
JMS WS WebSocket
Gateway
Order System
Fulfillment
CRM
JMS
Trading Engine
Application Logic
Persistence
![Page 38: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/38.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 38
Client-side
![Page 39: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/39.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 39
JavaScript Client
No plugin or installation Simply insert a script tag:
<script type="text/javascript" language="javascript" src="StompJms.js"></script>
![Page 40: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/40.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 40
Establish the Connection
ConnectionFactory cFactory = (ConnectionFactory) jmsContext.lookup("ConnectionFactory"); connection = cFactory.createConnection(username, password);
cFactory = new StompConnectionFactory(url); connectionFuture = cFactory.createConnection(username, password, connectionCallback); function connectionCallback() { connection = connectionFuture.getValue(); }
Java
JavaScript
![Page 41: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/41.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 41
Create the Session
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Java
JavaScript
![Page 42: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/42.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 42
Subscribe to a Topic
topic = session.createTopic("/topic/stock"); consumer = session.createConsumer(topic); consumer.setMessageListener(onMessage)
topic = session.createTopic("/topic/stock"); consumer = session.createConsumer(topic); consumer.setMessageListener(onMessage);
Java
JavaScript
![Page 43: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/43.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 43
Publish a Message
dest = session.createQueue(name); producer = session.createProducer(dest); textMsg = session.createTextMessage(message); message.setStringProperty(propName, propValue); producer.send(textMsg);
dest = session.createQueue(name); producer = session.createProducer(dest); textMsg = session.createTextMessage(message); message.setStringProperty(propName, propValue); producer.send(textMsg);
Java
JavaScript
![Page 44: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/44.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 44
Publish a Message
Optional callbacks for blocking calls:
dest = session.createQueue(name); producer = session.createProducer(dest); textMsg = session.createTextMessage(message); message.setStringProperty(propName, propValue); producer.send(textMsg);
dest = session.createQueue(name); producer = session.createProducer(dest); textMsg = session.createTextMessage(message); message.setStringProperty(propName, propValue); producer.send(textMsg, mySendCallback); function mySendCallback() { log("Message has been sent"); }
Java
JavaScript
![Page 45: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/45.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 45
Infrastructure & Security
![Page 46: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/46.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 46
Simplified Unified Architecture
Client
Client
Removes architecture in way
Application Server Farm
Proxy(s) Load Balancer(s)
Cluster
Trading Engine
News Feed
Payment System
Database Storage
Application Logic
Web Service
ERP/CRM System
JMS
WebSocket
WebSocket
SSL Termination
![Page 47: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/47.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 47
Simplified Unified Architecture
Client
Client
Lives in the DMZ. Connections fail fast. Single access point.
Application Server Farm
Cluster
Trading Engine
News Feed
Payment System
Database Storage
Application Logic
Web Service
ERP/CRM System
JMS
WebSocket
WebSocket
SSL Proxy LB
Trusted Network DMZ Web
![Page 48: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/48.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 48
Simplified Unified Architecture
Client
Client
Lives in the DMZ. Connections fail fast. Single access point.
Application Server Farm
Cluster
Trading Engine
News Feed
Payment System
Database Storage
Application Logic
Web Service
ERP/CRM System
JMS
WebSocket
WebSocket
SSL Proxy LB
• Security on the edge • Fail fast • Fine-grained authorization • Single Sign-On
Trusted Network DMZ Web
![Page 49: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/49.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 49
Key Takeaways
![Page 50: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/50.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 50
JMS Over the Web
Standard JMS 1.1 API JMS end-to-end Guaranteed message delivery JMS authentication and authorization Publish and subscribe to queues and topics Send and receive text and binary messages Multiple acknowledgement modes Priority, Expiration, and Delivery Mode support Client-initiated transactions Slow consumer message buffering Automatic reconnect for dropped connections
![Page 51: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/51.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 51
WebSocket
Full-duplex Low latency Low bandwidth Port 80/443 compatible Can transport higher-level protocols Enables New Architectures
• Not just for speeding up the client-server hop
![Page 52: Messaging over the Web with WebSocket & JMS · 2012-08-14 · WebSocket is Two Standards WebSocket Protocol Standards Body: IETF Status: RFC6455 HTML5 WebSocket API (or interface)](https://reader030.vdocument.in/reader030/viewer/2022040308/5f0a06627e708231d429a65b/html5/thumbnails/52.jpg)
Copyright © 2012 Kaazing Corporation. All Rights Reserved. 52