سؤال

I would like to build a app with private chat powered by SockJS using Vert.X. I quickly ran into limitation of SockJS because of it's simplistic API and multiplexing doesn't seem to be the answer (see: https://groups.google.com/d/topic/sockjs/cO7lnH07RCE/discussion ).

Would EventBus Bridge be the right tool? Each client binds to a unique address, and VertX server can respond to them, or ignore them by default if not recognized?

Is that the intent of EventBus Bridge?

Can permit rules be changed once the SockJSBridge is started?

Randomized token (UUID?) can also be added to inbound rule "match" to simulate how session would work.

Is this reasonable? or has this been wildly used?

هل كانت مفيدة؟

المحلول

The EventBusBridge lets clients (browsers via SockJS) talk with other subscribers on the EventBus. That means you can send messages directly with Server-side Services or other clients.

You cannot change the permit/firewall rules for the bridge dynamically. But with regular expressions and using UUIDs, you should be able to implement a chat quite easily. Let me give you an example:

The server listens on address chat-server. The outbound setting in the bridge is set to { "address_re" : "chat-clients\..*" }. Every client registers a handler on chat-clients.<some_UUID_for_this_client> and tells the server to send messages addressed to the client to the registered address.

We have written a chat module in Scala, which you can use as a reference.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top