Skip to content

WebSocket Connection Setup 320% Slower Than Target #8

@BP602

Description

@BP602

Problem

Connection setup takes 2.1s average vs 500ms target due to sequential authentication pattern in SharedKickPusher.

Impact

  • Slow app startup with multiple chatrooms
  • Poor user experience when adding new rooms
  • Exponential scaling issues (5 rooms = 12s setup)

Root Cause

// sharedKickPusher.js:410-431 - Sequential auth blocks parallel connection
for (const event of userEvents) {
  const AuthToken = await window.app.kick.getKickAuthForEvents(event, this.socketId);
  // Each auth call blocks next connection
}

Solution

  1. Implement parallel authentication using Promise.all()
  2. Add shared connection pool with authentication caching
  3. Remove artificial stagger delays where unnecessary

Success Criteria

  • Connection setup <800ms for 5 chatrooms
  • Parallel authentication implementation
  • 99.5%+ connection success rate maintained

Files to Modify

  • utils/services/kick/sharedKickPusher.js
  • utils/services/connectionManager.js

Priority: P0 (Critical)
Estimated Effort: 2-3 days

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions