How to send messages from server to client?

前端 未结 6 817
轮回少年
轮回少年 2021-02-08 13:12

I am going to implement something similar to Facebook notification and this website (StackOverflow\'s notification which is notifying us if anyone write a comment/answer etc for

6条回答
  •  甜味超标
    2021-02-08 13:47

    Use Node JS and socket.io

    This technology chooses the best transportation method based on the browser that the client is using.

    For latest browsers it uses Web Sockets and for others it degrades gracefully to Flash Socket or Long Pooling. See more here

    What you need to do is set up a server using these technologies. The server would run at a particular port. All clients would listen to that port and server would be able to push data to the client through that port.

提交回复
热议问题