vert-x3 / issues

Apache License 2.0
37 stars 7 forks source link

Selective EventBus 'Publish' #151

Open shvalb opened 8 years ago

shvalb commented 8 years ago

Allow removing users' registered to specific address upon server invokes 'publish' via EventBus.

Motivation: There are many situations where users register to a specific address (channel) in order to receive pushed messages from server. In some situations the server would like to remove a specific user from this "channel". Very useful for Chat\Games\Forums servers !

At this point: Only the user can invoke 'unregister'! - Server doesn't have any control over this!

Desired flow: Upon user register to a specific channel, Vertx\EventBus generates a unique key which is internally stored distributedly. and exposed from API. When server wants to remove a specific user from channel - It simply invokes: eventBus.unregister("address", uniqueKey);

Workaround Each user registers on a unique address and server needs to manage it internally. Making 'publish' unuseful.

Thank you.

javadevmtl commented 7 years ago

+1 I had similar situation here: https://groups.google.com/forum/#!searchin/vertx/javadevmtl%7Csort:relevance/vertx/sPqBE79tx2U/EAkRgfhqEgAJ

Each user gets their own unique eventbus address. So even if you have common address like com.xxx.chat you also can have com.xxx.chat,user1-abcd, this allows to pub/sub eb messages to that specific user.

You have to rely on the browser to call unregister. Further more you need to have access to the actual consumer object to unregister the address even on the server side.

We should be able to interrogate the eventbus to get list of addresses and manage them as required.