作者:可爱鬼猫_380 | 来源:互联网 | 2023-05-18 22:34
IhavemadeadatingwebsitewhereIhaveuseonetoonechattingapplicationlikefacebook.Whenon
I have made a dating website where I have use one to one chatting application like facebook. When one user send any message to another user it showing into their popup chat box, but I have done this using ajax. Which I have run in every interval using Javascript setInterval function. But I think the process is not optimize one. I don't want to make unnecessary request to the server each time, rather it only trigger when there is some new message for that user. Is there any other way to do it or any other protocol which using by big site like facebook, gmail?
我已经建立了一个约会网站,我使用一对一的聊天应用程序,如Facebook。当一个用户向另一个用户发送任何消息时,它会显示在弹出的聊天框中,但我已经使用ajax完成了此操作。我使用Javascript setInterval函数在每个区间运行。但我认为这个过程不是优化过程。我不希望每次都向服务器发出不必要的请求,而只是在该用户有新消息时触发。有没有其他方法可以做到这样或任何其他协议使用像facebook,gmail这样的大型网站?
4 个解决方案