Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

WebSocket JEE 7

No description
by

Michael Jo

on 1 June 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of WebSocket JEE 7

Lunch & Learn What
Why
How Share Knowledge Stay Current Committee Exchange ideas Any topics Technology, culture, books, hobby, etc Get Motivated Know your Team Topics Presenter Maintain knowledge HTML 5 Compatibility Most browser supports WebSocket caniuse.com Technology Support .NET .NET Framework 4.5
on Windows 8 or Windows server 2012 Technology Support Java JSR356, Java API for WebSocket in JEE 7 JEE 7 lauch June 11, 2013 Glassfish 4.0 build 89 Enjoy Suggestion & Idea JEE Container Java Java EE 7 leveraging WebSocket (JSR356) HTML 5 Server
Application JavaFX JavaScript iOS Client Non-Java implementations
compliant with RFC 6455 Non-Java implementations
compliant with RFC 6455 var uri = "ws://localhost:8080/Demo/WebSocket"
var ws = new WebSocket(uri);
ws.onopen = function(event){alert("Open");};
ws.onmessage = function(event){onMessage(event)};
ws.onclose = function(event){alert("Close!");};
ws.onerror = function(event){alert("Error" + event.data};
function onMessage( event ){
//Do something when receive a message from server
}
function sendMyMessage(){
ws.send("Hello server!");
} onopen when the connection is established onclose when connection is terminated onmessage fires whenever client
receives a message from the server onerror fires when there is an error WebSocket annotations @ServerEndpoint
@ClientEndpoint
@OnOpen
@OnClose
@OnMessage
@OnError WebSocket in JEE 7 Before Websocket Long polling Comet Complex, hack What's cool about WebSocket Low latency Light weight Full Duplex channel Normal traffic unaffected Http is half duplex Request Handshake Response Handshake GET /chat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==Origin: http://example.comSec-WebSocket-Protocol: chat, superchatSec-WebSocket-Version: 13 HTTP/1.1 101 Switching ProtocolsUpgrade: websocketConnection: UpgradeSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=Sec-WebSocket-Protocol: chat open

message

message

close open

message

message

Connection channel is established Data types : text, binary
JEE 7 offers encoder/decoder Client Server Disconnect the channel How efficient is it? Http Request/Response : 871 bytes
Use case A: 1,000 clients polling every second: Network throughput is (871 x 1,000) = 871,000 bytes = 6,968,000 bits per second (6.6 Mbps)
Use case B: 10,000 clients polling every second: Network throughput is (871 x 10,000) = 8,710,000 bytes = 69,680,000 bits per second (66 Mbps)
Use case C: 100,000 clients polling every 1 second: Network throughput is (871 x 100,000) = 87,100,000 bytes = 696,800,000 bits per second (665 Mbps)
WebSocket : 2 bytes

Use case A: 1,000 clients receive 1 message per second: Network throughput is (2 x 1,000) = 2,000 bytes = 16,000 bits per second (0.015 Mbps)

Use case B: 10,000 clients receive 1 message per second: Network throughput is (2 x 10,000) = 20,000 bytes = 160,000 bits per second (0.153 Mbps)

Use case C: 100,000 clients receive 1 message per second: Network throughput is (2 x 100,000) = 200,000 bytes = 1,600,000 bits per second (1.526 Mbps) WebSocket Demo Video Comparing latency How about Websocket in Jave EE 7? Websocket Chat Application Demo Thank you for attending.
Hope we can do this regularly. http://mjtoolbox.wordpress.com/ Michael Jo
Full transcript