What is the fundamental difference between WebSockets and pure TCP?

前端 未结 4 2084
庸人自扰
庸人自扰 2020-12-04 04:47

I\'ve read about WebSockets and I wonder why browser couldn\'t simply open trivial TCP connection and communicate with server like any other desktop application. And why thi

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 05:11

    Websocket is a application layer protocol while TCP is transport layer protocol. At transport layer, we usually have TCP and UDP protocol. Any message from application layer need to go through transport layer to be transmitted to other machine. Hence, websocket and tcp have a relationship to each other and can not be comparable.

提交回复
热议问题