Comet vs WebSocket

1. Comet

web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.
http://en.wikipedia.org/wiki/Comet_(programming) )

Implementations
1) polling 
2) long polling: 
3) streaming : use chunked


2. WebSocket

a web technology providing full-duplex communications channels over a single TCP connection
http://en.wikipedia.org/wiki/WebSocket )

Features
Like TCP, WebSocket provides for full-duplex communication
Websocket differs from TCP in that it enables a stream of messages instead of a stream of bytes

WebSockets connection limit

| Chromium | Chrome | Safari | Firefox | Opera |
|      924      |    3237   |  2970  |   200    |   900    |
ex) http://www.websocket.org/echo.html

3. Benefit/Drawback

WebSocket 을 사용할 경우
- 전송 대기 시간이 줄어듬.
- 네트워크 오버헤드가 적다.
- 모든 웹브라우저에 지원되는것은 아니다.

4. Other

WS = Works Superior

 1. Starts with an HTTP handshake
  − Transparent to proxies (well, it’s supposed to be)
  Request Haed :
     Sec-WebSocket-Key : base64( 16 random bytes )
  Response Head :
     Sec-WebSocket-Accept: base64( SHA-1( challenge + GUID ) )
 2.  “ping” / “pong” frames for keep-alive
 3.  Data frames don’t have HTTP overhead
  − No headers, cookies, authentication
 4.  Data frames don’t have HTTP security
  − No headers, cookies, authentication


댓글

이 블로그의 인기 게시물

JTDS&Mabatis 에서 MSSQL NVARCHAR 처리

"구글이 목표를 달성하는 방식 OKR" - 독서 후기

Lecture 2 "Supervised Learning Setup Continued" -Cornell CS4780 SP17