P
P
Petr Volkhanov2014-04-26 12:53:08
JavaScript
Petr Volkhanov, 2014-04-26 12:53:08

Who can tell more about Comet, Long Polling, Websockets, Webworkers and Server-Sent Events (SSE)?

I think many of you have read about Comet, Long Polling, Websockets, Webworkers and Server-Sent Events (SSE). Who can tell more about these technologies and where they can be applied when creating web applications?
It would also be interesting to look at examples of working code in order to see the live work of the above technologies.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor, 2014-10-05
@eprivalov

Comet, Long Polling, Websockets Here's an
example of using a comet server with an online demo
Online chats
. Event notifications.
Browser-based multiplayer games.
Real-time charts . The main feature of Webworkers is that 1. inside Webworkers, all calls are synchronous, while for regular js, for example, ajax is asynchronous.
2. it is executed in a separate thread from the GUI thread - this means that if you run a script there that will take a long time to execute, then this will not affect the responsiveness of the web page and it will not freeze, although if something like this is run in the main js thread, then until js has completed new ones calls like onClick will not be called since js is asynchronous but will be executed in one thread, and Webworkers is executed in a separate thread.
This, for example, is suitable for implementing a js bitcoin miner.

K
kazhuravlev, 2014-04-26
@kazhuravlev

You just want to try it but don't know where or why?
If so, you can use persistent connections, for example, to instantly notify users about the occurrence of some event. For example about a new message. This increases the responsiveness of the interface and also reduces the load on the server (this is partly due to the fact that, unlike periodic requests to the server for new data, there is no need to spend time and resources creating a new connection - this is expensive
) in messengers. To ensure that messages can be delivered instantly.
In general, there are many articles on the Internet on this topic, and a lot of code. Here , here and somewhere else))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question