7. JJUG ?Cross ?Community ?Conference ?2014 ?Fall
HTML5環境の新しいアプリケーションスタイル
§??「サーバーサイドMVC」から「クライアントMVC」へ
7
Web Browser
Application Server
Application
HTTP
Request
HTML/JS
Controller Session
Data
View
Business
LogicModel
DomainDomain
Web Browser
Application Server
Application
View
HTML/JS
Controller
Data
Store
Model
Model
DomainDomain
RESTful or
WebSocket
JSON
Business Logic
従来のWebアプリケーション Single Page Application (SPA)
8. JJUG ?Cross ?Community ?Conference ?2014 ?Fall
HTML5におけるクライアント?サーバー連携
§??通信?方法
–?RESTful (JAX-RS 2.0)
?? HTTPの原則にしたがった
簡潔なシステム間連携の設計手法
–?WebSocket (WebSocket 1.0)
?? ブラウザとWebサーバーの間で
双方向通信を可能にする
通信プロトコル
§??データ型
–?JSON:JavaScript Object Notation
(JSONP 1.0)
?? JavaScriptのオブジェクトとして
そのままパースできる
テキスト形式のデータ表記法
8
Web Browser
Application Server
Application
View
HTML/JS
Controller
Data
Store
Model
Model
DomainDomain
RESTful or
Web Socket
JSON
Business Logic
24. JJUG ?Cross ?Community ?Conference ?2014 ?Fall
クライアント側にProxyがある場合
§??WebSocketのリクエストはCONNECTメソッドで開始
§??TLS ?/ ?SSLが正常につかえる環境であればOK
§??すでにAjax ?/ ?Cometが多数普及しているため
??長時間のコネクションへの対応は済んでいる(はず)
24
_Proxy Usage_: If the client is configured to use a proxy when using the WebSocket Protocol to
connect to host /host/ and port /port/, then the client SHOULD connect to that proxy and ask it to
open a TCP connection to the host given by /host/ and the port given by /port/.
EXAMPLE: For example, if the client uses an HTTP proxy for all traffic, then if it was to try to
connect to port 80 on server example.com, it might send the following lines to the proxy
server:
CONNECT example.com:80 HTTP/1.1
Host: example.com
RFC 6455