Skip to content

Conversation

@dkhalife
Copy link
Owner

@dkhalife dkhalife commented Jul 9, 2025

Summary

  • add WebSocket message types
  • integrate user repo reference into WSServer
  • stub out handleMessage pending future implementation
  • update websocket server tests
  • remove README websocket API section

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_686cbadf2eb4832abb8274c9fedc8a5f

Copilot AI review requested due to automatic review settings July 9, 2025 02:30
Copy link
Contributor

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 enhances the WebSocket server by introducing typed message structs, per-user connection tracking with keepalive ping/pong, and stubs out future message handling. Tests are updated to reflect the new constructor signature and use helpers for dialing and waiting on connections.

  • Add WSMessage/WSResponse types for structured WebSocket I/O
  • Refactor WSServer to accept repo dependencies, track userConnections, and implement ping/pong keepalive
  • Update server_test.go for new constructor, dialing helper, and waitForConnections

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/ws/server.go Refactored WSServer: new constructor params, userConnections map, ping/pong logic, stubbed handleMessage
internal/ws/server_test.go Updated tests: call new constructor with nil repos, added dial & waitForConnections helpers, adjusted assertions
internal/ws/message.go Added WSMessage and WSResponse structs for typed JSON messages
Comments suppressed due to low confidence (1)

internal/ws/server.go:156

  • The route registered here (/api/ws) differs from /ws used in your tests. Aligning the endpoint path or centralizing route registration will prevent confusion and ensure consistency.
	router.GET("/api/ws", auth.MiddlewareFunc(), s.HandleConnection)

@codecov
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 27.27273% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/ws/server.go 27.27% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@dkhalife dkhalife merged commit b0ecfda into main Jul 9, 2025
5 checks passed
@dkhalife dkhalife deleted the codex/create-ws-message-and-response-structs branch July 9, 2025 02:35
dkhalife added a commit that referenced this pull request Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants