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

proof of concept: alternative implementation of put_session #3672

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SteffenDE
Copy link
Collaborator

@SteffenDE SteffenDE commented Feb 11, 2025

Related: #3671

Does NOT use an extra HTTP request.

sequenceDiagram
    participant HTTP
    participant LiveView
    participant Client

    LiveView->>LiveView: Call put_session
    alt Dead Render
        HTTP->>Client: Store values in conn session
    else LiveView Connected
        LiveView->>Client: Send diff with updated data-phx-session and token
        Client->>Client: Set token as special cookie (not HTTP-only)
    end
    Note over Client,HTTP: On next dead render (redirect or refresh)
    Client->>HTTP: Request contains special cookie
    HTTP->>Client: Apply extra session values from cookie to session
Loading

This is a proof of concept for session manipulation from LiveViews.
It works by pushing an encoded token to the client, which in turn performs
a POST request that updates the session cookie.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant