Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Clustered Jetty WebSockets: accessing session in other servers

Hi,

On Mon, Apr 18, 2016 at 3:53 PM, Tickling Contest
<tickling.contest@xxxxxxxxx> wrote:
> My scenario is a chat-room application that runs on Jetty WebSockets servers
> fronted by HAProxy or some such load balancer.
>
> In a typical chat-room like application, when participants in a chat room
> are load balanced across several servers, I am trying to understand how the
> WebSockets application disseminates the chat message from one participant to
> other chat room participants in the chat-room who may be connected to other
> WebSocket servers in the cluster.

Sure.

> It appears like JDBC session-clustering,
> for example, cannot work here as this does nothing for this WebSocket issue
> (https://dev.eclipse.org/mhonarc/lists/jetty-users/msg03161.html), though it
> appears like session clustering can help in getting the identity of the
> server the other chat room participant is connected to currently.

HTTP session clustering does not help you with WebSocket.

> Is my understanding correct? If so, what solutions exist to solve the
> WebSocket/chat-room problem I describe above?

CometD (https://cometd.org).

It's a sister project to Jetty, and provides all you need and more for
distributed chats.

Extended documentation: http://docs.cometd.org/

Already existing distributed chat you can base on:
https://github.com/sbordet/oort-chat-demo

> My temporary solution was to
> have each WS server that is load balanced by the HAProxy solution be
> connected to the other WS servers in the cluster other via WebSocket (or
> other technologies like RabbitMQ) and a simple messaging between them to
> achieve the chat message dissemination I need in the chat room application.

Already all figured out by CometD, and much more.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top