Build a whole site using just websockets (via socket.io and node.js, no Ajax)?

前端 未结 4 1610
囚心锁ツ
囚心锁ツ 2021-02-08 07:39

Is this possible? Has anyone tried it?

Using websockets means there are no httpheaders being exchanged (like in a Ajax request) so there is definately a boost in speed o

4条回答
  •  滥情空心
    2021-02-08 08:08

    Build a whole site using just websockets (via socket.io and node.js, no Ajax)? Is this possible? Has anyone tried it?

    I didn't hear of such a thing, but there are many websites that use Ajax intensively.

    Using websockets means there are no httpheaders being exchanged (like in a Ajax request) so there is definately a boost in speed of page display, however with the sockets you are holding a connection to the server even when nothing maybe happening, is this detrimental as number of users increase?

    First of all not all the browser support native websockets, just a few actually do so probably most of your users will have to do some long-pooling or something similar.

    with a connection being held between client and server, can the server still handle other clients connecting on the same port?

    You are right here, but I guess if you are using something like Node.js and don't have tens of thousands of users connected this won't be a problem.

提交回复
热议问题