Shanan
Shanan

Reputation: 342

How does CometD handle ports in long polling?

Does a specific port handle all requests/responses from a client-side in long polling using CometD? If not how does it assign the ports for each request?

Upvotes: 1

Views: 175

Answers (1)

sbordet
sbordet

Reputation: 18507

A CometD client can use either HTTP or WebSocket as a transport.

In both cases, when the CometD client needs to open a new TCP connection to the server, the local port is assigned by the operative system in the range of the ephemeral ports (this varies from OS to OS).

Note that for HTTP, a CometD client typically opens at most 2 connections (one dedicated to long-polling, one for publishes).

For WebSocket, a CometD client opens just 1 connection.

On the server, a single port (the listening port) is used to accept incoming connections from CometD clients.

Upvotes: 1

Related Questions