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 listener trait to listen to the creation, update and destruction of sessions #43

Open
octoape opened this issue Apr 26, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@octoape
Copy link

octoape commented Apr 26, 2023

Add a listener trait to listen to the creation, update and destruction of sessions

@maxcountryman
Copy link
Owner

Thanks for the suggestion. Do you have an idea of what the implementation would look like?

@maxcountryman maxcountryman added enhancement New feature or request help wanted Extra attention is needed labels Apr 30, 2023
@octoape
Copy link
Author

octoape commented May 17, 2023

I think it should be similar to the listener API of the javaee servlet

trait SessionListener {
  fn onSessionCreated(self: Self, event: SessionEvent);
  fn onSessionDestoryed(self: Self, event: SessionEvent);
  fn onAttributeAdded(self: Self, event: SessionAttributeEvent);
  fn onAttributeReplaced(self: Self, event: SessionAttributeEvent);
  fn onAttributeRemoved(self: Self, event: SessionAttributeEvent);
}

@czocher
Copy link

czocher commented Jun 17, 2023

I suggest a slightly different interface:

pub enum AttributeEvent {
    Add(AddEvent),
    Replace(ReplaceEvent),
    Remove(RemoveEvent)
}

pub enum SessionEvent {
    Create(CreateEvent),
    Destroy(DestroyEvent),
    Modify(AttributeEvent)
}

trait SessionListener {
    fn onEvent(&self, event: SessionEvent);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants