Downside of using Server-Sent events for bidirectional client-server communication (instead of WebSockets)

后端 未结 2 489
孤街浪徒
孤街浪徒 2021-02-02 14:10

Recently I\'ve found out of Server-Sent events as a much simpler alternative to WebSockets for doing push from the server. Most places that compare them (like here, here and her

2条回答
  •  梦谈多话
    2021-02-02 14:38

    Ajax requests are huge compared to small WebSocket messages. Standard HTTP requests (Ajax) include a lot of headers including cookies with every request while WebSocket messages is just a few bytes.

    The good thing with HTTP (Ajax) request is that they are easier to cache if that is a benefit for your problem.

提交回复
热议问题