blacknight Posted July 11, 2013 Share Posted July 11, 2013 so im working on this chat app for a sit im working on .. the main feature is a 3 room tabbed chat window each room displays the chat text and the users in the room but this is not my issue as its working as intended. my issue is we are adding group and user chat where a user can start a group room and chat with users they add and we want to use 1on1 user chats ... the question is should i use a separate hartbeat for each chat div or have 1 update them all? Quote Link to comment https://forums.phpfreaks.com/topic/280072-ajax-heartbeat-question/ Share on other sites More sharing options...
kicken Posted July 11, 2013 Share Posted July 11, 2013 Have a single request to the server for your updates. Format the output of the request in such a way that you can pass all the relevant information for each tab (and anything else) into a single response and then have your JS update things as necessary. Trying to manage several update requests is going to get messy quickly when you start having a bunch of chat tabs open, you may also hit browser limits causing things to slow down. Browsers generally limit the number of concurrent requests to a given domain to 2, further requests are queued. There may also be a cap on the number of concurrent requests one can make regardless of the destination domain. Quote Link to comment https://forums.phpfreaks.com/topic/280072-ajax-heartbeat-question/#findComment-1440405 Share on other sites More sharing options...
blacknight Posted July 12, 2013 Author Share Posted July 12, 2013 excellent advice my out put is formatted in a json array and doing it all in 1 request should be easy for me as my script sends the relevant chat channels to the request file Quote Link to comment https://forums.phpfreaks.com/topic/280072-ajax-heartbeat-question/#findComment-1440428 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.