feat(api): add /api/ws canonical listener route; keep /ws as compat alias#15
Merged
feat(api): add /api/ws canonical listener route; keep /ws as compat alias#15
Conversation
…lias - Register GET /api/ws (canonical) alongside GET /ws (compat alias). Both delegate to the same ws.HandleListenerWS so behavior is identical. - Frontend listener client now connects to /api/ws. - Vite dev proxy covers both /api/ws and /ws with WebSocket upgrade. - Add api_test.TestListenerWSAlias asserting both routes are registered and share the same handler. - Deployment guide reverse-proxy section now lists /api/ws alongside /ws and /api/admin/ws as paths needing WS-upgrade forwarding. The /ws alias is kept for existing Trunk-Recorder / SDRTrunk / rdio- scanner-shaped clients during the legacy-API transition.
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.
What
GET /api/ws(canonical) alongsideGET /ws(compat alias). Both delegate to the samews.HandleListenerWSso listener behavior is identical on either path./api/ws./api/wsand/wswith WebSocket upgrade.api_test.TestListenerWSAliasasserting both routes are registered and share the same handler./api/wsalongside/wsand/api/admin/wsas paths needing WS-upgrade forwarding.Why
OpenScanner's canonical API is
/api/*; the listener WebSocket was the one stray inherited endpoint living at/ws. This adds the canonical path without breaking existing Trunk-Recorder / SDRTrunk / rdio-scanner-shaped clients that still speak to/ws. First step toward a coherent/api/surface.Blast radius
No wire-protocol changes. No schema changes. No auth surface changes. Pure additive route registration + frontend URL swap.
Verification
go build ./... && go vet ./... && go test ./internal/api/... ./internal/ws/...— greenpnpm exec tsc --noEmit && pnpm test -- --run— 188/188 tests passChangelog
[Unreleased]entries added under### Addedand### Changed.