Is it Ok to use HTTP REST API for Chat application?

后端 未结 5 603
眼角桃花
眼角桃花 2020-12-23 17:24

We are building a chat application in Android. We are thinking of using HTTP REST API to send outbound messages. Wanted to know if its a good approach or has any downsides c

5条回答
  •  不知归路
    2020-12-23 18:02

    Short answer No.

    I would not start a new project or recommend starting a new project (since you mentioned start afresh) that needs a live bi-directional communication that relies on HTTP - as stateless protocol. You may take comfort that the connection is kept alive but there is no guarantee.

    Your + HTTP endpoint is easy to scale horizontally on server side pro is a pro in the context when HTTP is used as request and response style and when it is considered stateless. It becomes somewhat moot (although not entirely) when you inherently need to keep the connection alive.

    HTTP does offer another following benefit that you have not mentioned in here.

    • HTTP is easy to deal with corporate firewall proxies when other ports may be blocked.

    This is where WebSockets or XMPP over HTTP will have better success rate as mentioned by others.

提交回复
热议问题