feat(mx-space): switch realtime socket to @mx-space/ws-client - #120
Conversation
Replace socket.io-client with the raw-ws @mx-space/ws-client package,
matching mx-core's new /ws/admin contract (query-token auth, dot-style
BusinessEvents, {v,event,payload} envelope). Reconnect/backoff is now
built into the client; lifecycle logging moves to $state.
SafeDep Report SummaryPackage Details
This report is generated by SafeDep Github App |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19e2fda9ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| timeout: 10000, | ||
| forceNew: true, | ||
| const client = createWsClient({ | ||
| url: `${toWsOrigin(appConfig.mxSpace.gateway)}/ws/admin`, |
There was a problem hiding this comment.
Strip legacy paths before appending the WebSocket route
When MX_SPACE_GATEWAY_ENDPOINT uses the repository's legacy path form, such as the example http://127.0.0.1:2333/system in app.config.ts:19, this produces ws://127.0.0.1:2333/system/ws/admin rather than the new root endpoint ws://127.0.0.1:2333/ws/admin, so the socket cannot connect once this currently dormant path is re-enabled. Build the URL from the configured URL's origin, or explicitly replace its pathname, instead of concatenating onto the entire input.
Useful? React with 👍 / 👎.





Summary
Companion PR to mx-space/core#2810 — rewrites
src/modules/mx-space/socket.tsfrom socket.io-client to@mx-space/ws-client(/ws/admin, query-token auth, dot-style event names,$statelifecycle logging). Full-enum subscription preserves the old catch-all logging behavior.Note:
createMxSocketwas already dead code before this change (the live realtime path is the HTTP webhook handler) — rewritten faithfully but not re-wired; decide separately whether to re-wire or delete.@mx-space/ws-clientand@mx-space/webhookare temporaryfile:links to a local mx-core worktree; swap to published npm semver once core v14 shipsMX_SPACE_GATEWAY_ENDPOINTcarries no legacy namespace-style path (…/system) — the new URL is<origin>/ws/adminVerification: tsc/eslint/build clean on Node 24; tsdown confirmed to inline the linked package into dist.