
Research
/Security News
77 Firefox Extensions Linked to Crypto Wallet and Credential Theft
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.
@msgmesh/sdk
Advanced tools
MsgMesh 的 TypeScript SDK(Node / 瀏覽器通用,基於 fetch)。是整個前端生態的唯一 HTTP 真相源——MCP server 與面板都複用它。
先在面板註冊帳號、簽發一把 API key(明文僅顯示一次),再:
import { MsgMesh } from "@msgmesh/sdk";
const mq = new MsgMesh({
apiKey: process.env.MSGMESH_KEY, // 伺服器端用長期 key
controlPlaneUrl: "https://cp.example.com",
gatewayUrl: "https://gw.example.com",
realtimeUrl: "https://rt.example.com",
});
await mq.createTopic("orders");
await mq.publish("orders", { hello: 1 });
const msgs = await mq.poll("orders", { group: "g1" });
getToken,不要放 API key瀏覽器裡的東西都會外洩,不要把長期 API key 放進前端。改採 token-broker:後端(持 key)呼叫
POST /v1/tokens 換一張短期 dp token,前端只拿 token;SDK 會自動快取、將過期前重取,SSE 重連時亦換新。
const mq = new MsgMesh({
// 不放 apiKey;給一個「去我後端拿短期 token」的函式
getToken: async () => (await fetch("/api/mm-token")).then((r) => r.json()), // { token, expires_in }
gatewayUrl: "https://gw.example.com",
realtimeUrl: "https://rt.example.com",
});
mq.stream("room.42", (data) => console.log(data)); // SSE;token 過期自動換新後重連
mq.streamWs("room.42", (data) => console.log(data)); // WebSocket;同介面,SDK 自管重連
即時接收兩種選擇,介面一致、皆回傳停止函式:
stream(SSE):靠瀏覽器原生 EventSource(有原生自動重連),走 /…/sse。僅瀏覽器。streamWs(WebSocket):全域 WebSocket(瀏覽器原生;Node ≥ 22 內建),走 /…/ws。WebSocket 無原生重連,故由 SDK 接管:每次斷線退避 1s 重連,成功連上即重置失敗計數;連續失敗達上限(未曾連上)即停止(避免對已撤銷的憑證或持續不可用的端點無限重連),getToken 模式另在重連前換新 token。撤權若在連線中發生為 CLOSE 1008 authorization revoked(立即停);若在握手期(HTTP 401→CloseEvent 1006)則由上限收口。適合 SSE 被中間層擋掉、或已有 WS 基礎設施的場景。Node < 22 無全域 WebSocket 會拋錯,改用 subscribe(長輪詢)。後端(~5 行)代呼 /v1/tokens(可帶 capabilities 降權為金鑰能力子集,只准更窄)後把結果回傳即可。
controlPlaneUrl(治理 API)、gatewayUrl(收發)、realtimeUrl(SSE/WS/presence)。
未指定時 SDK 退回本機開發預設值(http://localhost:8080/8081/8082),只適合本機;
生產環境連不上時錯誤訊息會附「請指定 controlPlaneUrl/gatewayUrl/realtimeUrl」提示。getToken。producer、收訊需 consumer、管理需 admin(通吃);又推又收/細粒度的資料面鍵可用中性
key scope(強制附 capabilities)。getToken 模式僅供資料面(收發),呼叫治理端點會 401/403。非 2xx 回應會依狀態碼拋型別化錯誤(都繼承 MsgMeshError,帶 status/code/path):
import { ValidationError, AuthError, NotFoundError, RateLimitError } from "@msgmesh/sdk";
try {
await mq.createTopic("Bad Name!");
} catch (e) {
if (e instanceof ValidationError) console.error("參數不合法:", e.message);
else if (e instanceof RateLimitError) console.error("被限流,稍後重試");
else throw e;
}
| 狀態碼 | 型別 | code |
|---|---|---|
| 400 / 422 | ValidationError | validation |
| 401 / 403 | AuthError | auth |
| 404 | NotFoundError | not_found |
| 429 | RateLimitError | rate_limit |
| 其他 | MsgMeshError | server |
createTopic / listTopics / deleteTopicpublish / poll / subscribe(輪詢)/ stream(SSE,瀏覽器)/ streamWs(WebSocket,瀏覽器 + Node ≥ 22)/ getPresencelistKeys(回傳含 capabilities/name)/ createKey(可帶 scope+capabilities)/ deleteKeylistWebhooks / createWebhook / deleteWebhook / reactivateWebhookregisterSchema / listSchemas / getLatestSchema / deleteSchemaregisterFunction / getFunction / deleteFunction(JavaScript / WASM)getPlan / setPlan;用量:getUsagegetSettings / setStrictTopics(資料面 topic 閘門開關)getBilling / getDepositAddresses / getDeposits / getLedger / getUsageDebits / getDepositStatusgetSnippet / getDocs / getAudit、DLQ dlqPeek / dlqReplay註冊、超管(finance/租戶治理)走面板 session,不在本 SDK。
npm test -w @msgmesh/sdk && npm run build -w @msgmesh/sdk
FAQs
MsgMesh TypeScript SDK — publish / consume / realtime (SSE / WebSocket) / governance client for the multi-tenant event bus, universal across Node and the browser.
The npm package @msgmesh/sdk receives a total of 93 weekly downloads. As such, @msgmesh/sdk popularity was classified as not popular.
We found that @msgmesh/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket uncovered 77 linked Firefox extensions, including 40 that steal wallet secrets or credentials and 37 deceptive sports-score shells.

Security News
NIST disclosed an unreleased AI tool called V-etalon and opened a broad inquiry into NVD modernization after years of automation plans produced no public enrichment system.

Security News
In his AI Council 2026 talk, Feross Aboukhadijeh covers recent package compromises, vulnerability discovery, and a more automated security model.