WebSocket learning summary

RecentlyIfinishtoreadonebookabouthtml5websocket.Followingsaresomesummaryfrommylearningprogress.

HTML5coversthelargenumberofimprovementsandchangeshappeninginwebtechnologies,andincludeseverythingfromthemarkupyouuseonyourwebpagestotheCSS3styling,offlineandstorage,multimedia,connectivity,andsoon.

"TheConnectivityareaofHTML5includestechnologieslikeWebSocket,Server-SentEvents,andCross-DocumentMessaging".

  1. WebSocketispartoftheHTML5.NamelyConnectivitysectionoftheHTML5specificationincludesWebSocket.
  2. WebSocketisnaturallyfull-duplex,bidirectionalsingle-socketconnection.
  3. Withwebsocket,Httprequestbecomesasinglerequesttoopenawebsocketconnectionusinghandshakeprocess,lateryoucanreusetheconnectionfromclienttoserverandfromservertoclient.
  4. WebSocketAPI:events:open,message,error,close.

methods:send

attribute:readyState(0oponning,1open,2closing,3closed)

attribute:bufferedAmount,protocol

WebSocketProtocalrequestfromclient:

GET/echoHTTP/1.1

Host:echo.websocket.org

Origin:http://www.websocket.org

Sec-WebSocket-Key:7+C600xYybOv2zmJ69RQsw==

Sec-WebSocket-Version:13

Upgrade:websocket

responsefromserver:

101SwitchingProtocols

Connection:Upgrade

Date:Wed,20Jun201203:39:49GMT

Sec-WebSocket-Accept:fYoqiH14DgI+5ylEMwM2sOLzOi0=

Server:KaazingGateway

Upgrade:WebSocket

UsingmessagingoverWebSocketwithXMPPUsingmessagingoverWebSocketwithSTOMPWebSocketsecurityusingTLS(SSL)overTCP.

相关推荐