Communication between several HttpServers with websockets

32 views
Skip to first unread message

elr1c...@gmail.com

unread,
Apr 17, 2018, 12:25:41 PM4/17/18
to vert.x
Hello,

I have a requirement to support several HttpServers in cluster mode. 

Let's say for example I have 2 HttpServers in cluster mode, user1 is connected via websocket to HttpServer1 and user2 is connected via websocket to HttpServer2.

If user1 wants to send a message to user2, he has to know its event bus address to send a message. The only way I see to achieve that is to store in a clustered shared data map each user websocket address (given by SockJSSocketBase writeHandlerID which is a consumer address available on the cluster, but WebSocketImplBase has only local consumers, this implies to use SockJSSocketBase absolutely ), so each user can retrieve the address of the user he wants to send a message.

Is it the way to go or is there a better solution ?

Thanks by advance.


Julien Viet

unread,
Apr 20, 2018, 2:13:53 PM4/20/18
to ve...@googlegroups.com
actually I'm not even sure this would work because the handlerID won't be routable from the other node (as you said it's local consumer).

I'm wondering actually why SockJSSocket supports clustered address and WebSocket supports local.

Paulo: do you have any clue of this reason ?

It would make sense to actually make this more coherent (and provide an option to configure it for local / global / none registration)

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/7593fb20-ead1-402d-af7b-b0cbcadeba6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

elr1c...@gmail.com

unread,
Apr 21, 2018, 3:19:29 PM4/21/18
to vert.x
I have not tested but normally it should work with SockJSSocket, but not with WebSocket.

Otherwise, the workaround would be to create an explicit global consumer address anytime a user connects to a websocket. This is not optimal as the handlerID would be useless.

Does vertx has some limits about the number of consumer addresses it can support in cluster mode ?

Thanks by advance.
Reply all
Reply to author
Forward
0 new messages