Skip to content

Conversation

@mentatai
Copy link
Contributor

@mentatai mentatai bot commented Sep 25, 2025

This PR adds a basic WebSocket echo server to the Express app and a simple UI in the React client to interact with it.

Server:

  • Attach a WebSocketServer on path /ws to the existing HTTP server
  • Send a welcome message on connect and echo any message received
  • Add TypeScript typings and @types/ws to ensure stable compilation

Client:

  • Add a “WebSocket Echo” section in the app with:
    • Connection status indicator
    • Input field and Send button
    • Scrollable message log showing welcome and echo messages
  • Update Vite dev proxy to forward /ws WebSocket traffic to the server
  • Use a relative ws URL so it works in both dev (via proxy) and production (same-origin)

How to test:

  1. Run the dev environment (already set up in the preview).
  2. Open the client preview, type a message in “WebSocket Echo,” and press Send.
  3. You should remain connected and see the echoed message.

Closes #5 (basic WebSocket echo request)


🤖 This PR was created with Mentat. See my steps and cost here

  • Wake on any new activity.

mentatai bot and others added 2 commits September 25, 2025 07:02
- Server:
  - Add `ws` dependency
  - Attach `WebSocketServer` on path `/ws` to existing Express HTTP server
  - Type-safe handlers and basic welcome + echo behavior

- Client:
  - Add WebSocket proxy in Vite for `/ws`
  - Implement simple WebSocket UI in App:
    - Connects automatically
    - Input + Send button
    - Status indicator and message log

This enables a basic echo experience:
- Frontend connects to `/ws` (proxied in dev, same-origin in prod)
- Server echoes any message back to the client

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/24b3f169-bec0-44a3-b7db-8ea4c36ccc44

Co-authored-by: granawkins <[email protected]>
…t server

- Install `@types/ws` as devDependency to provide typings for `ws`
- Stabilizes dev server so WebSocket connection no longer drops

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/3dc26dad-dd5f-47ab-85f1-2447b035cb84

Co-authored-by: granawkins <[email protected]>
@mentatai mentatai bot requested a review from granawkins September 25, 2025 07:03
mentatai bot and others added 5 commits September 25, 2025 07:04
…roxy conflicts

- Server: WebSocketServer now listens on `/socket`
- Client: connect to `/socket`
- Vite dev proxy updated to forward `/socket` as WebSocket

Please refresh the client preview and try again. You should see a stable connection and echoed messages.

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/45d2ba12-79f3-4528-ab63-e7d4d54a882b

Co-authored-by: granawkins <[email protected]>
…t.RawData)

Also implemented your requested fallback:
- Added HTTP endpoints:
  - POST `/messages` to submit a message
  - GET `/messages?sinceId=<n>` to poll for new messages
- Client now:
  - Sends with POST
  - Polls every 1s for new messages and updates the log

Please refresh the preview and try the “Simple Messages (1s polling)” section.

Mentat precommit script failed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/2931512c-7ecd-45cb-a19f-88df908228b2

Co-authored-by: granawkins <[email protected]>
… param)

- Remove unused `useRef` import
- Use empty catch to satisfy @typescript-eslint/no-unused-vars

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/a0dbdaf7-a266-409b-b548-18f632143654

Co-authored-by: granawkins <[email protected]>
- Assert section titles separately (Frontend/Backend/Utilities)
- Assert details strings exactly (React, Vite, Vitest / Node.js, Express, Jest / TypeScript, ESLint, Prettier)

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/030115d9-0caf-4042-bf82-abab30dfe1e9

Co-authored-by: granawkins <[email protected]>
…ce writes

- Client:
  - Stabilized polling loop (background interval, no re-inits)

- Server:
  - Persist messages to repo-level `persist/messages.json` (outside `server` dir)
    to avoid `ts-node-dev` watching file writes and restarting the server
  - Added `persist/**` to .gitignore

This should stop the page from refreshing every second. Please refresh once and try sending messages again.

Mentat precommit script passed. Log: https://qa.mentat.ai/gh/AbanteAI/qa-party/log/d7d3697e-b412-462a-8e63-deef2e539974

Co-authored-by: granawkins <[email protected]>
@mentatai
Copy link
Contributor Author

mentatai bot commented Sep 25, 2025

A user interrupted me on my agent page. I'll keep working if there's more activity here.

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.

1 participant