rstoyanchev / spring-websocket-portfolio

740 stars 443 forks source link

How does Spring mange websocket connections to broker? #48

Closed yoav200 closed 10 years ago

yoav200 commented 10 years ago

Hi, As i understand each client eventually open a connection to the broker (i use RabbitMq), can this be configured? can i limit the max connections?

rstoyanchev commented 10 years ago

To the broker it's TCP connections (rather than WebSocket) and they're managed with the TCP client from the Reactor project. The number of connections to the broker is equivalent to the number of connections from WebSocket clients. So to ask about limiting one is really to ask about limiting both/either.

rstoyanchev commented 10 years ago

To answer the question though there is nothing built-in. It shouldn't be too hard to achieve though. A combination of a HandshakeHandlerInterceptor perhaps plus an ApplicationListener counting SessionConnectedEvent and SessionDisconnectedEvent.