admin管理员组文章数量:1420078
I want to know what is exactly AJAX heartbeat pattern and what is the difference between it and jquery setInterval
Because im making an AJAX chat and I don't want to pull the data every 15 seconds I want to make a connection to the server to avoid delay is that what called heartbeat ? Also I want a good tutorial to make this or any suggestion from you
Note: I have pleted the implementation with setInterval but I saw that heartbeat is better way to avoid delay
I want to know what is exactly AJAX heartbeat pattern and what is the difference between it and jquery setInterval
Because im making an AJAX chat and I don't want to pull the data every 15 seconds I want to make a connection to the server to avoid delay is that what called heartbeat ? Also I want a good tutorial to make this or any suggestion from you
Note: I have pleted the implementation with setInterval but I saw that heartbeat is better way to avoid delay
Share Improve this question edited Nov 14, 2011 at 13:54 Smamatti 3,9313 gold badges33 silver badges44 bronze badges asked Nov 14, 2011 at 13:31 SederSeder 2,7632 gold badges24 silver badges43 bronze badges 3- Afaik this is a design pattern and not a function. You keep sending requests to the server, so the server knows the user/browser is still present. - First hits on google... – Smamatti Commented Nov 14, 2011 at 13:38
- In my question in the first line i asked what is AJAX heartbeat pattern and i said its pattern I am hitting google since two days and I came here because here i can see experts that already done this before and can give me the concept better not punishing me for my question anyway thank you for your help I will appreciate reading the question first and consider that I will not ask here until i am out of solutions – Seder Commented Nov 14, 2011 at 13:43
- It's a deisgn pattern and not a function. You knew that, ok. I downvoted this question, because I don't see the research effort in it since the first result on google explain the pattern. - I may decided to harsh. Fixed it. Please state the next time your research effort more clear. – Smamatti Commented Nov 14, 2011 at 13:55
1 Answer
Reset to default 7Heartbeat is a design pattern, this means it's a way of coding solutions.
Here a technique is meant, where you keep sending requests to the server, so the server knows the user/browser is still present. There are several use-cases for this pattern, for example to prevent timeouts of sessions etc.
You cannot really pare a design pattern to a function, because setInterval
could be used to implement this pattern. You would keep sending request in a specified interval.
I don't have a tutorial at hand, but the first hits on google already contain some examples.
本文标签: javascriptWhat is AJAX HeartBeat and what is the difference between it and setIntervalStack Overflow
版权声明:本文标题:javascript - What is AJAX HeartBeat and what is the difference between it and setInterval - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745327556a2653662.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论