Websocket API to replace REST API?

后端 未结 10 1650
温柔的废话
温柔的废话 2020-12-02 03:43

I have an application whose primary function works in real time, through websockets or long polling.

However, most of the site is written in a RESTful fashion, which

10条回答
  •  自闭症患者
    2020-12-02 04:05

    The only problem I can using TCP (WebSockets) as your main web content delivery strategy is that there is very little reading material out there about how to design your website architecture and infrastructure using TCP.

    So you can't learn from other people's mistakes and development is going to be slower. It's also not a "tried and tested" strategy.

    Of course your also going to lose all the advantages of HTTP (Being stateless, and caching are the bigger advantages).

    Remember that HTTP is an abstraction for TCP designed for serving web content.

    And let's not forget that SEO and search engines don't do websockets. So you can forget about SEO.

    Personally I would recommend against this as there's too much risk.

    Don't use WS for serving websites, use it for serving web applications

    However if you have a toy or a personal websites by all means go for it. Try it, be cutting-edge. For a business or company you cannot justify the risk of doing this.

提交回复
热议问题