Skip to content

fix: Correct WebSocket transport detection through Databricks proxy #54

@datasciencemonkey

Description

@datasciencemonkey

Problem

Socket.IO sets connected=true even when it falls back to HTTP long-polling through the Databricks Apps reverse proxy. The current code trusts this flag, which causes:

  1. Premature poll-worker termination — the app thinks it has a real WebSocket, stops the HTTP polling fallback, but actually doesn't have a WebSocket
  2. Degraded performance — users on long-polling don't get the poll-worker they need

Proposed Fix (cherry-pick from PR #52)

PR #52 includes a WebSocket detection fix that is independent of the OpenCode fork:

  • Check socket.io.engine.transport.name instead of trusting connected=true
  • Listen for late transport upgrades (polling → websocket)
  • Only terminate the poll-worker when a true WebSocket is confirmed

Why separate from PR #52

This is a change to static/index.html only. It doesn't require the OpenCode fork, spawner app, or any other PR #52 components.

Files affected

  • static/index.html — transport detection logic

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions