Y
Y
Yeldos Adetbekov2016-11-06 13:55:20
JavaScript
Yeldos Adetbekov, 2016-11-06 13:55:20

How to attach an event listener to the client?

Greetings. I organize a chat (correspondence) on django. I would like to know how messengers, etc. receive messages without ajax (Their pages do not send or receive requests every 2 seconds). How do messages arrive instantly? How to organize a client listener on the user's side and on the sender's server, so as not to fill up with endless ajax requests? Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
albalyu, 2016-11-07
@dosya97

You need to use either AJAX or sockets. If you don't want to mess with sockets, use long polling. Scheme:
The schema works fine via AJAX. See here for more details.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question