Dab tsi yog qhov txawv ntawm qhov (socket) thiab WebSocket?
Dab tsi yog qhov txawv ntawm qhov (socket) thiab WebSocket?

Video: Dab tsi yog qhov txawv ntawm qhov (socket) thiab WebSocket?

Video: Dab tsi yog qhov txawv ntawm qhov (socket) thiab WebSocket?
Video: Tuag Ua Dab Tsi💘by TXOS LAUJ / Nkauj Tawm Tshiab 2021 Official 2024, Kaum ib hlis
Anonim

WebSockets feem ntau khiav los ntawm cov browsers txuas mus rau Daim Ntawv Thov Kev Pabcuam dhau ntawm cov txheej txheem zoo ib yam li HTTP uas khiav TCP / IP. Yog li lawv feem ntau yog rau Web Applications uas xav tau kev sib txuas mus tas li rau nws cov server. Ntawm qhov tod tes, dawb cov qhov (socket) . muaj zog thiab muaj zog dua.

Raws li txoj cai, kev siv WebSocket yog dab tsi?

WebSockets muab kev sib txuas tsis tu ncua ntawm tus neeg siv khoom thiab lub server uas ob tog tuaj yeem ua tau siv pib xa cov ntaub ntawv txhua lub sijhawm. Tus neeg siv khoom tsim tau a WebSocket kev sib txuas los ntawm cov txheej txheem hu ua WebSocket tuav tes. Cov txheej txheem no pib nrog cov neeg siv khoom xa cov lus thov HTTP mus rau lub server.

WebSockets siv cov chaw nres nkoj dab tsi? Cov WebSocket kev sib txuas siv tib yam chaw nres nkoj raws li HTTP (80) thiab HTTPS (443), los ntawm lub neej ntawd.

Hais txog qhov no, WebSockets yog dab tsi nws txawv ntawm

HTTP thiab WebSocket yog raws tu qauv, uas yog siv rau hloov/rendering cov ntaub ntawv. HTTP yog auni-directional kev sib txuas lus raws tu qauv, whereas WebSocket yog bi-directional. Thaum twg thov los ntawm HTTP , nws tsim kev sib txuas ntawm tus neeg siv khoom (browser) thiab kaw nws thaum cov lus teb los ntawm lub server tau txais.

Dab tsi yog qhov zoo dua Ajax?

WebSockets tseem me ntsis sai dua tab sis qhov sib txawv yog negligable. WebSockets yog kwv yees li 10-20% sai dua tshaj AJAX . Ua ntej koj hais, yog kuv paub tshaj WebSocketweb apps los nrog lwm yam zoo xws li muaj peev xwm tuav tau rau hauv cov qhov (sockets) thiab thawb cov ntaub ntawv ntawm lub siab nyiam los ntawm lub server.

Pom zoo: