[Hawkular-dev] how to identify UI clients and which should get responses

Juraci Paixão Kröhling jpkroehling at redhat.com
Mon Sep 21 03:57:51 EDT 2015


On 09/18/2015 06:27 PM, John Mazzitelli wrote:
> 1) I'm logged into the UI using two different browser tabs. In one, I send a "deploy an application" request. Once the response comes back - do I show the response in both tabs? What if I closed the tab that performed the deploy? What should happen?

I'd say that "notifications" could be shown in all screens.

> 2) I am logged in kettle #1 as "jdoe" and someone else is logged in kettle #2 as the same "jdoe". I deploy an application. Should that other person get the response that a new app was deployed, too?

*This* could be the start of a bigger feature. For instance, do I want 
to be notified if anyone in my organization has deployed something on a 
server where I'm a SuperUser?

> The way I am thinking about this is Google Drive. I could be logged into my Google Drive account on any number of browsers or tabs - when I make a change to a document in Drive, that change is immediately reflected in every browser/tab I have open to Google Drive, not just in the browser that made the change. Is this the kind of thing we want? Or do we only want the browser that is making the requests get the responses?

Not for all cases. See the "Export JDR" for a situation where you don't 
want this: I don't want to have 5 download prompts, one for each tab, if 
I clicked on "Export JDR" only on the first tab.

So, I think *notifications* can be performed across tabs, but not all 
actions are the same.

> One thing I am thinking is hawkular-accounts gives us some common ID (not the token) that we assign a UI client and that ID floats in all requests and responses. The bad thing about this is we'll never know the UI client ID until they send their first request.

We have already the Persona for each request and for each socket, so, we 
might not need another ID. A consumer of the Accounts WebSocket API 
could just request the session IDs for a given persona. Accounts would 
need to be notified during the onClose of the socket, so that the 
session is removed, but I think this could work.

> Another thing I am thinking is have it work just like feeds - a feed connects via the URL ws://host/hawkular-command-gateway/feed/<FEED ID>. We could let each UI generate their own id and connect via ws://host/hawkular-command-gateway/ui/<UI ID>. The good thing here is the UI knows its ID immediately (since it generated it) and we know it from the start without even getting an initial message (and we can link it with that websocket session easily). Bad thing is only that UI will be able to get responses - it won't work the "Google Drive way" where a user logged into N browsers will get responses in all N browsers.
>
> Thoughts?

I haven't checked how Google does it, but there's a technique for 
inter-tab communication using localStorage. So, doing this via Web 
Socket is not needed/required. In fact, we do something like this 
already with Keycloak: if you have two tabs opened, actions on one tab 
refreshes your token in the other tab. So, you are not "inactive" in the 
second tab, if you are active on the first.

This means: you can still have the "notify all tabs" feature having only 
1-to-1 communication between sockets/tabs.

- Juca.


More information about the hawkular-dev mailing list