Web sockets server side processing model

后端 未结 4 1291
野性不改
野性不改 2021-02-08 05:42

To implement a server supporting clients using web sockets, do servers keep an open HTTP connection with each client? How can this scale?

What are the \"programming mod

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-08 05:52

    it differs from http in that each subsequent request / response doesn't need to be wrapped in an http message with http headers. so real-time apps wouldn't need the overhead of parsing headers. after the initial http-like handshake, it basically behaves like a regular ol' tcp socket.

    this could be modelled with servlets, but one would just need to distinguish between the initial request (with all the headers) and the subsequent 2-way dialog whose format is arbitrary for the most part.

提交回复
热议问题