Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a WebSocket-based notification system #29

Closed
acoburn opened this issue Jan 31, 2018 · 7 comments
Closed

Add a WebSocket-based notification system #29

acoburn opened this issue Jan 31, 2018 · 7 comments

Comments

@acoburn
Copy link
Member

acoburn commented Jan 31, 2018

The SOLID specification recommends using WebSockets for notifications, and I think this would be a good way to provide an embedded message broker for Trellis.

There are a few outstanding questions to resolve w/r/t implementation. First, SOLID suggests making websocket endpoints available on each resource. This seems like a very interesting idea, as the notifications can be scoped to a particular resource or container of resources.

  1. If a websocket is initiated at resource /foo, should notifications from all contained resources be made available (i.e. recursively?) or just those that that relate to that resource/container?
  2. If 1. is answered in the negative, is there a resource location where all notifications can be accessed?
@acoburn acoburn added the area/http HTTP module label Jan 31, 2018
@acoburn acoburn added this to the 0.7.0 Release milestone Jan 31, 2018
@acoburn acoburn added this to To Do in Trellis Linked Data server via automation Jan 31, 2018
@christopher-johnson
Copy link
Member

This could be relevant:
https://github.com/solid/solid/issues/70

@acoburn
Copy link
Member Author

acoburn commented Feb 8, 2018

@christopher-johnson I read through the SOLID proposal you mentioned, and there are some very good ideas there.

One part of the proposal that seems to be really useful in an LDP context is the resource-centric notion of pub-sub. The other (slightly contrasting) idea is that, rather than subscribing to resources a client subscribes with a URL template, and any notifications for resources that fit that template are passed to the client. These are pretty different approaches, and one option would be to implement both and let the developer who's wiring things together decide on which one to use.

The only problematic part of the proposal (from the perspective of Trellis) involves persistent subscriptions -- i.e. a client subscribes persistently and then retrieves notifications that occurred when the client wasn't connected. While that is certainly a very nice feature, it would change the implementation from a fairly straight-forward event notification system to a full-featured message broker. And if users want a full message broker, I think it would be better to use an existing external system that already does this very well.

This still leaves the question from above as to whether WebSockets should be purely resource-centric (only notifications for that particular resource) or based on URL templates. Given that this feature is slated for Summer 2018 on the roadmap, we have plenty of time to think about the design for this.

One big advantage to the resource-centric subscription model is that Authorization becomes transparent to a client: if you can access a resource, you can access notifications for that resource. OTOH, a URL template-based approach means that a client could (potentially) receive notifications for resources that the client does not have access to. So in that case, would one have to apply per-client WebAC rules for each notification? That seems very resource intensive.

At the moment, I am more intrigued by the resource-centric pub-sub model.

@christopher-johnson
Copy link
Member

While that is certainly a very nice feature, it would change the implementation from a fairly straight-forward event notification system to a full-featured message broker.

RIght. I think that a message broker is necessary if persistence is a requirement. Would it be possible to delegate "exactly once semantics" to Kafka (et. al.) and then wire a KafkaConsumer into the Websocket interface? What library would you use for the websocket publisher? I noticed the the JDK incubator client has some websocket features for subscribers. Camel support is limited for websockets, AFAIK.

@christopher-johnson
Copy link
Member

the first bit of this would be an API for user-managed topics/subscriptions?

A basic kafka implementation process could be:

  1. user creates topic and event filter for resource/resource group
  2. async stream processor applies filter and produces to new topic.
  3. extension (camel?) consumes topic and publishes to websocket endpoint. (not clear to me how to parameterize topic selector from websocket endpoint request).

@acoburn
Copy link
Member Author

acoburn commented Sep 18, 2018

The current thinking is to use the Java EE Websocket interfaces and annotations along with the Tyrus reference implementation.

@acoburn acoburn added the solid label Nov 13, 2018
@acoburn acoburn modified the milestones: 0.9.0 Release, 0.10.0 Release Mar 12, 2019
@acoburn
Copy link
Member Author

acoburn commented Jul 3, 2019

I would like to suggest closing this issue. WebSocket-based notifications have a lot of potential benefits, but this seems outside the scope of Trellis as an LDP server. This sort of feature could be applied as an extension module in a down-stream application, but implementing it in the Trellis repository seems unnecessary.

@acoburn acoburn removed this from the 0.10.0 Release milestone Jul 3, 2019
@ajs6f
Copy link
Member

ajs6f commented Jul 3, 2019

👍 to closing. If WebSockets takes on some new importance, we can always revisit.

@acoburn acoburn closed this as completed Jul 3, 2019
Trellis Linked Data server automation moved this from To Do to Done Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants