socket.io setinterval way

后端 未结 2 636
[愿得一人]
[愿得一人] 2020-12-30 13:19

I want to make a web page for give the client the news of his friends every 1 second using socket.io + node.js.

My codes :

Client :

<
2条回答
  •  醉梦人生
    2020-12-30 13:41

    That's pretty much the standard way to do it. If you've not already looked the example apps page on socket.io, there's a beibertweet example that does just this using setInterval.

    Also there's a slightly more advanced example on this blog.

    Plus .. I found Ryan Dahls's intro on YouTube really useful for understanding the basics of node operation.

    Hope that helps.

提交回复
热议问题