Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent connection with client

Is there a general way to implement part of an application with JavaScript and supplying a persistent connection to a server? I need the server to be able to push data to the client, regardless of the client being behind a firewall. Thanks in advance

like image 522
Ulf Avatar asked Jan 29 '09 22:01

Ulf


People also ask

What is meant by persistent connection?

A persistent connection (HTTP persistent connection) is a network communication channel that remains open for further HTTP requests and responses rather than closing after a single exchange.

How do I know if my connection is persistent?

TCP connections that are kept open after transactions complete are called persistent connections. Nonpersistent connections are closed after each transaction. Persistent connections stay open across transactions, until either the client or the server decides to close them.

What do you mean by persistent and non-persistent connection?

This case stands for a single object transmission. After the client receives the object in non-persistent, the connection is immediately closed. This is the basic difference between persistent and non-persistent. The persistent connection ensures the transfer of ​multiple objects over a single connection.

How do I enable persistent connections?

Click Action > Configure Agents > Configure Persistent Connection. Note: The agent must be one for which Agent Manager appears in the Event Manager column. Do one of the following in the Configure Persistent Connection window: To enable the connection, select Enable Persistent Connections for selected agents.


2 Answers

See Comet - it's like ajax, but it holds a connection open so the server can push information to the client.

Note that compliant browsers will only hold 2 connections (note: most modern browsers no longer comply) to a particular domain (by default), so you might want to split your domains (e.g. www.yourdomain.com and comet.yourdomain.com) so that you don't drastically slow down the loading of your pages. Or you could just make sure you don't open the comet connection until everything else is loaded. It's just something to be careful of.

like image 133
Stephen Avatar answered Oct 18 '22 03:10

Stephen


You should look into Comet:

http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications

like image 3
BobbyShaftoe Avatar answered Oct 18 '22 03:10

BobbyShaftoe