I'm using Atmosphere in my Spring MVC app to facilitate push, using a streaming
transport.
Throughout the lifecycle of my app, the client will subscribe and unsubscribe for many different topics.
Atmosphere seems to use a single http connection per subscription - ie., every call to $.atmosphere.subscribe(request)
creates a new connection. This quickly exhausts the number of connections allowed from the browser to the atmosphere server.
Instead of creating a new resource each time, I'd like to be able to add and remove the AtmosphereResource
to broadcasters after it's initial creation.
However, as the AtmosphereResource
is a one-to-one representation of the inbound request, each time the client sends a request to the server, it arrives on a new AtomsphereResource
, meaning I have no way to reference the original resource, and append it to the topic's Broadcaster
.
I've tried using both $.atmosphere.subscribe(request)
and calling atmosphereResource.push(request)
on the resource returned from the original subscribe()
call. However, this made no difference.
What is the correct way to approach this?