Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Help 

AJAX calls and jQuery

Alright, so I have a very web application that has a chatting feature. This chatting feature is literally just a PHP script refreshed every second thanks to AJAX calls on setTimeout. Since it is so AJAX heavy, a few players from Oceania are having latency issues, so the chat system is not exactly instant. I get that the main issue is via the network, but is there a more effective way than just using setTimeout/setInterval?

I feel as if I should stray away from jQuery for this chat system, and maybe move to a socket chat. However, the only library I know is jQuery. What is a good alternative that will be fast and lightweight?
No need to refresh the site
You just could call an API for the new messages and edit the html elements with jQuery
The sooner you ditch jQuery, the better off you will be as a developer.

Take a look at Socket.io


I used to eat poop. I still do, but I used to.
(Feb 3, 2016 05:21 PM)JIM NASIUM'S GYMNASIUM Wrote:  The sooner you ditch jQuery, the better off you will be as a developer.

Take a look at Socket.io

Socket.io is absolutely beautiful.

A chat application is their getting started guide --> http://socket.io/get-started/chat/

[Image: tkg318I.png]
(Feb 3, 2016 05:21 PM)JIM NASIUM'S GYMNASIUM Wrote:  The sooner you ditch jQuery, the better off you will be as a developer.

Take a look at Socket.io

Uh no that doesn't even make sense. You shouldn't even be using Ajax for a chat application, sockets is better suited. And also, jQuery is widely used and popular JS library.
(Feb 6, 2016 09:07 AM)+Haze Wrote:  Uh no that doesn't even make sense. You shouldn't even be using Ajax for a chat application, sockets is better suited. And also, jQuery is widely used and popular JS library.

Right... which is why I told him to take a look at Socket.io.

jQuery used to be very widely used, but there is a big push to move away from it to reduce the amount of overhead that it brings as a side-effect. If you only use jQuery for AJAX, for example, use something like superagent instead, which was built for doing only AJAX. That way, you don't bog down your client with this huge jQuery dependency when you're only really using one of its features.


I used to eat poop. I still do, but I used to.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Help] by .eXeJul 23, 2018 03:48 AM 7 142 Jul 23, 2018 03:48 AM
Last Post: .eXe
[Help] by .eXeJul 20, 2018 01:33 PM 0 75 Jul 20, 2018 01:33 PM
Last Post: .eXe
[Help] by Exeption™Jul 4, 2017 08:32 AM 7 255 Jul 4, 2017 08:32 AM
Last Post: Exeption™