Skip to content

feat(mx-space): switch realtime socket to @mx-space/ws-client - #120

Merged
Innei merged 3 commits into
mainfrom
feat/ws-migration
Aug 15, 2026
Merged

feat(mx-space): switch realtime socket to @mx-space/ws-client#120
Innei merged 3 commits into
mainfrom
feat/ws-migration

Conversation

@Innei

@Innei Innei commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

Companion PR to mx-space/core#2810 — rewrites src/modules/mx-space/socket.ts from socket.io-client to @mx-space/ws-client (/ws/admin, query-token auth, dot-style event names, $state lifecycle logging). Full-enum subscription preserves the old catch-all logging behavior.

Note: createMxSocket was 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.

⚠️ DRAFT — do not merge yet

  • @mx-space/ws-client and @mx-space/webhook are temporary file: links to a local mx-core worktree; swap to published npm semver once core v14 ships
  • If re-wiring, verify the ops MX_SPACE_GATEWAY_ENDPOINT carries no legacy namespace-style path (…/system) — the new URL is <origin>/ws/admin

Verification: tsc/eslint/build clean on Node 24; tsdown confirmed to inline the linked package into dist.

Innei added 3 commits August 15, 2026 02:31
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.
@Innei
Innei marked this pull request as ready for review August 15, 2026 07:31
@safedep

safedep Bot commented Aug 15, 2026

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Red Risky License Badge

Package Details
Package Malware Vulnerability Risky License Report
icon @mx-space/ws-client @ 0.1.0
pnpm-lock.yaml
ok icon
ok icon
red cross icon
🔗
icon @mx-space/webhook @ 1.0.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗

View complete scan results →

This report is generated by SafeDep Github App

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

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.

@Innei
Innei merged commit 22db2e7 into main Aug 15, 2026
3 of 4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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