Skip to content

fix: reconstruct server.js message pipeline (closes #191) - #209

Merged
levibliz merged 2 commits into
RiftCore00:devfrom
ayomidemariam:fix/issue-191-reconstruct-server-pipeline
Jul 28, 2026
Merged

fix: reconstruct server.js message pipeline (closes #191)#209
levibliz merged 2 commits into
RiftCore00:devfrom
ayomidemariam:fix/issue-191-reconstruct-server-pipeline

Conversation

@ayomidemariam

Copy link
Copy Markdown
Contributor

Summary

Reconstructs src/server.js to meet all requirements specified in issue #191.

Changes

  • Added createRateLimiter import from ./rate-limiter.js for per-message rate limiting
  • Added safeSend(ws, data) helper function for all outbound messages with error handling
  • Implemented per-message rate limiting check before validation (drops messages from rate-limited clients)
  • Added rateLimiter.remove(actualClientId) on disconnect to clean up rate limit state
  • Removed ipConnectionCount and server from the return value (only returns { wss, rooms } as specified)

What was missing

The original server.js was missing:

  1. createRateLimiter import — per-message rate limiting was not implemented
  2. safeSend function — outbound messages had no error handling wrapper
  3. Rate limit state cleanup on disconnect
  4. The return value exposed internal state (ipConnectionCount, server) that should not be public

Acceptance Criteria

  • src/server.js exports exactly one createServer function
  • No SyntaxError when importing src/server.js
  • npm run lint passes with zero errors
  • npm test passes: all 18 test suites green (163 tests passed, 15 skipped postgres)
  • server.test.js: all 12 tests pass
  • binary-frames.test.js: all 4 tests pass
  • conn-rate-limiter.test.js: all 6 tests pass
  • max-connections.test.js: all 4 tests pass

Testing

All 18 test suites pass with 163 tests. No test files were modified. No new dependencies were added.

ayomidemariam and others added 2 commits July 24, 2026 07:29
- Import createRateLimiter from ./rate-limiter.js
- Add safeSend helper for outbound messages
- Implement per-message rate limiting before validation
- Clean up rate limiter state on disconnect
- Remove ipConnectionCount and server from return value
- All 18 test suites pass (163 tests)
@levibliz
levibliz merged commit 08ae5b8 into RiftCore00:dev Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants