feat: migrate login example to new Session API#8
Merged
Conversation
Updates the login example to use the new Session API instead of the deprecated Broadcaster API. Changes: - Replace BroadcastAware with SessionAware interface - Replace Broadcaster with Session for server-initiated updates - Use TriggerAction() instead of Send() for server push - Add serverWelcome action handler for welcome message - Fix StopDockerChrome test signature This example demonstrates: - HTTP form-based login with cookies - Server-initiated updates via Session.TriggerAction() - Multi-tab synchronization for the same user Requires: livetemplate/livetemplate#61 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR modernizes the login example by migrating from the deprecated Broadcaster API to the new Session API, improving code consistency and preparing for future framework updates.
- Replaces
BroadcastAwareinterface withSessionAwareinterface - Uses
Session.TriggerAction()instead ofBroadcaster.Send()for server-initiated updates - Updates test compatibility with new lvt testing library API signature
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| login/main.go | Migrates from Broadcaster to Session API; adds handleServerWelcome action handler; updates mutex handling for thread safety with new API |
| login/login_test.go | Updates StopDockerChrome call to match new API signature that no longer requires the command parameter |
| login/go.mod | Updates replace directive to point to main livetemplate worktree instead of auth-specific branch |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TriggerAction()for server-initiated updates (welcome message)Changes
BroadcastAware→SessionAwareinterfaceBroadcaster→Sessionfor server-initiated updatesTriggerAction("serverWelcome", data)instead ofSend()handleServerWelcomeaction handler in Change()StopDockerChrometest signatureDependencies
This PR requires livetemplate/livetemplate#61 to be merged first.
Test plan
🤖 Generated with Claude Code