Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

AJAX long polling request


From a client perspective, the AJAX long polling request looks similar to normal one. An important difference between them on the server side is that if the server doesn't have any information available or the client, it holds the request and waits for information to become available or for a suitable timeout, after which a completed response is sent to the client. The long polling requests reduces the amount of data that needs to be sent because the server only sends data when it is really available.

The long pooling request is useful in the following cases:

  • When your solution must work in old web browsers

  • When the data traffic between the client and server is low

  • When the implementation is very simple

The advantages of using the long pooling request are as follows:

  • It works across all browsers

  • It is easy to develop and perfectly fits in the legacy code without significant changes and effort

  • It can detect a connection failure quickly and resume a session to avoid data...