Contenu connexe Similaire à Realtime web application with java (20) Plus de JeongHun Byeon (20) Realtime web application with java1. RealtimeWeb
Application
withJava
ArawnOutsiderin봄싹
2011.6.19
17. 요청
응답
주기 이벤트
요청
브라우저 서버
18. 요청
응답
주기 이벤트
요청
응답
브라우저 서버
19. 사실...
서버푸시라고
하기는어렵습니다.
30. 요청
대기
응답
이벤트
요청
브라우저 서버
41. 요청
대기
이벤트
응답(Chunked)
브라우저 서버
42. 요청
대기
이벤트
응답(Chunked)
이벤트
브라우저 서버
43. 요청
대기
이벤트
응답(Chunked)
응답(Chunked) 이벤트
브라우저 서버
50. 웹페이지
요청
hiddeniframe
서버
51. 웹페이지
요청
hiddeniframe
ChunkedData
서버
52. 웹페이지
요청
hiddeniframe
ChunkedData
script데이터/script
서버
56. HTML5
W3C/IETF표준
WebSocket프로토콜사용
진정한양방향통신
57. HTTP를
업그래이드해서
웹소켓프로토콜을
연결한다
59. //요청
GET/demoHTTP/1.1
Upgrade:WebSocket
Connection:Upgrade
Host:example.com
Origin:http://example.com
Websocket-Protocol:sample
//응답
HTTP/1.1101WebSocketProtocolHandshake
Upgrade:Websocket
Connection:Upgrade
Websocket-Origin:http://example.com
WebSocket-Location:ws://example.com/demo
WebSocket-Protocol:sample
60. varws=
newWebSocket(ws://domain.com);
ws.onOpen=
function(e){console.log(opened);}
ws.onRead=
function(e){console.log(e.data);}
ws.onClose=
function(e){console.log(closed);}
ws.send(HelloWorld);
65. ThreadperRequest
ServletContainer
Request
Thread ServletPool
Request Servlet
Thread
Servlet
Request Servlet
Thread
Servlet
....
Request
Thread
68. CometServlet
publicinterface CometServletextendsServlet{
booleanservice(ServletRequest,ServletResponse,
CometController)
throwsServletException,IOException;
booleanresume(ServletRequest,ServletResponse,
CometController)
throwsServletException,IOException;
}
70. ResinCometServlet처리흐름
Job
Client CometServlet
Executor
service(cometCtrl)
execute(cometCtrl)
suspend
cometCtrl.wake()
resume
resume(cometCtrl)
72. Continuation
publicinterface Continuation{
publicbooleansuspend(longtimeout);
publicvoidresume();
...
}
74. CometProcessor
publicinterface CometProcessor
extendsServlet{
publicvoidevent(CometEvent)
throwsIOException,
ServletException;
}
77. interface HttpServletRequest
extendsServletRequest{
AsyncContextstartAsync();
AsyncContextstartAsync(
ServletRequest,ServletResponse);
}
78. publicinterface AsyncContext{
publicServletRequestgetRequest();
publicServletResponsegetResponse();
}
80. AsynchronousServlet처리흐름
Job
Client AsyncServlet
Executor
request.startAsync()
execute(asyncContext)
asyncContext.complete()
84. Clientside
WebBrowser
InternetExplorer/FireFox/Chrome/Safari...
CometClient
LongPolling/Streaming(XMLHttpRequest,foreveriframe)/WebSocket
Serverside
CometServer
86. Lightstreamer
scalableandreliableServerfor
pushinglivedatatoRich
InternetApplications
87. Socket.IO
J2EEServletbasedSocket.IO
serverimplementation.
88. Project
Atmosphere
aportableAjaxPush/Comet
andWebSocketFramework
90. Server Long Hidden Web Flash
Push polling iframe Socket Socket
Lightstreamer O O O O O
Socket.IO O O X O O
Atmosphere O O O O X
Streamhub O O O O O
91. Streamhub
-
QXQuiz
CodeReview
https://github.com
/spring-sprout
/jco-2011-realtime