Cov txheej txheem:

WebSockets siv li cas?
WebSockets siv li cas?

Video: WebSockets siv li cas?

Video: WebSockets siv li cas?
Video: Cas Tsis Xaiv Koj - R-Lin Thoj New Song Original By Zaj Dub [Official MV] 2023 2024, Kaum ib hlis
Anonim

webSockets yog ua raws raws li hauv qab no: Client ua HTTP thov rau server nrog "hloov dua" header ntawm qhov kev thov. Yog tias tus neeg rau zaub mov pom zoo rau kev hloov kho, ces tus neeg siv khoom thiab cov neeg rau zaub mov pauv qee cov ntaub ntawv pov thawj kev nyab xeeb thiab cov txheej txheem ntawm TCP lub qhov (socket) uas twb muaj lawm raug hloov los ntawm HTTP mus rau webSocket.

Ua li no, koj siv WebSockets li cas?

webSockets tau siv raws li hauv qab no:

  1. Client ua HTTP thov rau server nrog "hloov kho" header ntawm qhov kev thov.
  2. Yog tias tus neeg rau zaub mov pom zoo rau kev hloov kho, ces tus neeg siv khoom thiab cov neeg rau zaub mov pauv qee qhov kev lees paub kev ruaj ntseg thiab cov txheej txheem ntawm TCP lub qhov (socket) uas twb muaj lawm yog hloov los ntawm HTTP mus rau webSocket.

WebSocket siv qhov twg? Cov WebSocket raws tu qauv ua rau muaj kev sib cuam tshuam ntawm lub web browser (los yog lwm tus neeg siv daim ntawv thov) thiab lub web server nrog cov nyiaj siv ua haujlwm qis dua li ib nrab-duplex lwm txoj kev xws li HTTP kev xaiv tsa, ua kom yooj yim cov ntaub ntawv hloov pauv ntawm lub sijhawm thiab mus rau server.

Kuj nug, WebSockets ua haujlwm li cas?

A WebSocket yog kev sib txuas tsis tu ncua ntawm tus neeg siv khoom thiab server. WebSockets muab kev sib txuas lus bidirectional, full-duplex kev sib txuas lus uas ua haujlwm dhau HTTP los ntawm ib qho kev sib txuas ntawm TCP / IP. Ntawm nws qhov tseem ceeb, lub WebSocket raws tu qauv pab txhawb cov lus hla ntawm tus neeg siv khoom thiab server.

WebSocket programming yog dab tsi?

WebSocket yog kev sib txuas lus raws tu qauv rau kev pheej hmoo, ob-kev taw qhia, tag nrho duplex TCP kev sib txuas los ntawm tus neeg siv lub web browser mus rau lub server. Kev sib txuas lus tuaj yeem pib thaum kawg, uas ua rau lub vev xaib tshwm sim programming ua tau. Hauv qhov sib piv, tus qauv HTTP tso cai rau cov neeg siv tsuas yog thov cov ntaub ntawv tshiab.

Pom zoo: