Skip to content

feat: migrate login example to new Session API#8

Merged
adnaan merged 1 commit intomainfrom
feat/session-api
Nov 30, 2025
Merged

feat: migrate login example to new Session API#8
adnaan merged 1 commit intomainfrom
feat/session-api

Conversation

@adnaan
Copy link
Contributor

@adnaan adnaan commented Nov 30, 2025

Summary

  • Updates login example to use the new Session API instead of deprecated Broadcaster API
  • Uses TriggerAction() for server-initiated updates (welcome message)
  • Fixes test compatibility with updated lvt testing API

Changes

  • Replace BroadcastAwareSessionAware interface
  • Replace BroadcasterSession for server-initiated updates
  • Use TriggerAction("serverWelcome", data) instead of Send()
  • Add handleServerWelcome action handler in Change()
  • Fix StopDockerChrome test signature

Dependencies

This PR requires livetemplate/livetemplate#61 to be merged first.

Test plan

  • E2E browser tests pass
  • HTTP cookie tests pass
  • Server-initiated welcome message works via TriggerAction

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings November 30, 2025 06:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BroadcastAware interface with SessionAware interface
  • Uses Session.TriggerAction() instead of Broadcaster.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.

@adnaan adnaan merged commit 0f286a5 into main Nov 30, 2025
15 checks passed
@adnaan adnaan deleted the feat/session-api branch November 30, 2025 07:47
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.

2 participants