fix(#338): Enforce WSS in production and add connect_error handling

- Add validateWebSocketSecurity() to warn when using ws:// in production
- Add connect_error event handler to capture connection failures
- Expose connectionError state to consumers via hook and provider
- Add comprehensive tests for WSS enforcement and error handling

Refs #338

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-05 17:31:26 -06:00
parent 63a622cbef
commit dd46025d60
4 changed files with 194 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ describe("WebSocketProvider", (): void => {
mockUseWebSocket.mockReturnValue({
isConnected: true,
socket: null,
connectionError: null,
});
function TestComponent(): React.JSX.Element {
@@ -33,6 +34,7 @@ describe("WebSocketProvider", (): void => {
mockUseWebSocket.mockReturnValue({
isConnected: false,
socket: null,
connectionError: null,
});
const onTaskCreated = vi.fn();
@@ -86,6 +88,7 @@ describe("WebSocketProvider", (): void => {
mockUseWebSocket.mockReturnValue({
isConnected: false,
socket: null,
connectionError: null,
});
function TestComponent(): React.JSX.Element {
@@ -105,6 +108,7 @@ describe("WebSocketProvider", (): void => {
mockUseWebSocket.mockReturnValue({
isConnected: true,
socket: null,
connectionError: null,
});
rerender(