Skip to content

feat: update mesh-v2 examples for polling protocol and new API#372

Merged
takaokouji merged 4 commits intodevelopfrom
worktree-feat-mesh-v2-examples-polling
Mar 24, 2026
Merged

feat: update mesh-v2 examples for polling protocol and new API#372
takaokouji merged 4 commits intodevelopfrom
worktree-feat-mesh-v2-examples-polling

Conversation

@takaokouji
Copy link

Summary

  • Update mesh-client.js for new API (useWebSocket, maxConnectionTimeSeconds, polling mutations/queries)
  • Add full polling protocol support (UI + logic) alongside existing WebSocket mode
  • Track example source files in git (previously untracked due to *.js gitignore)
  • Update README for dual protocol documentation

Changes

mesh-client.js

  • createGroup: add useWebSocket: Boolean! (required) and maxConnectionTimeSeconds: Int params
  • Remove createdAt from all queries (not in schema)
  • Add useWebSocket, pollingIntervalSeconds to Group/Node response fields
  • New: searchGroupsByNamePrefix, getEventsSince, recordEventsByNode

app.js

  • Protocol-aware event sending: fireEventsByNode (WS) vs recordEventsByNode (Polling)
  • Polling loop: getEventsSince + listGroupStatuses at server-configured interval
  • Default heartbeat fallback: 60s -> 15s (stg value)
  • Session timer fallback: 10min -> 35min (prod maxConnectionTime=2100)

index.html

  • Protocol selection radio buttons (WebSocket / Polling) in Group Management
  • Polling status display (last poll time) in Current Group panel

.gitignore

  • Add !examples/**/*.js to track example source files

Implementation Steps

  • Phase 1: mesh-client.js API update
  • Phase 2: app.js polling support + defaults update
  • Phase 3: index.html UI update
  • Phase 4: bundle rebuild + README update

Definition of Done

  • CI green
  • createGroupuseWebSocket: true を渡してグループ作成が成功すること
  • ポーリングモード(useWebSocket: false)でイベント送受信ができること
  • WebSocket モードで従来通り動作すること
  • bundle が正常にビルドされること(npm run build in examples dir)

Closes #371

🤖 Generated with Claude Code

takaokouji and others added 4 commits March 24, 2026 13:47
- Add !examples/**/*.js to .gitignore to track example source files
- Add useWebSocket and maxConnectionTimeSeconds params to createGroup
- Remove createdAt from all queries (not in schema)
- Add useWebSocket and pollingIntervalSeconds to Group/Node responses
- Add searchGroupsByNamePrefix query
- Add getEventsSince query (polling protocol)
- Add recordEventsByNode mutation (polling protocol)
- Track mesh-client.js, app.js, and server.js in git (previously untracked)

Refs #371

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
app.js:
- Add WebSocket/Polling mode switching based on group.useWebSocket
- Implement polling loop (getEventsSince + listGroupStatuses)
- Use recordEventsByNode for event sending in polling mode
- Update default heartbeat interval fallback to 15s (stg value)
- Update session timer fallback to 35min (prod maxConnectionTime)
- Add stopCommunication() to centralize subscription + polling cleanup

index.html:
- Add protocol selection radio buttons (WebSocket / Polling)
- Add polling status display (last poll time) in Current Group panel

Refs #371

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add dual protocol support description (WebSocket / Polling)
- Update session time from 10min to 35min
- Add protocol selection instructions in Create Group section
- Note polling fallback behavior for firewalls

Refs #371

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
listGroupsByDomain and listNodesInGroup can return groups/nodes
created before useWebSocket was added, which have null values for
the non-nullable Boolean! field. Remove these fields from list
queries since they are available from createGroup/joinGroup responses.

Also fix group list badge to handle undefined useWebSocket gracefully.

Refs #371

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@takaokouji takaokouji merged commit cff4b34 into develop Mar 24, 2026
7 checks passed
@takaokouji takaokouji deleted the worktree-feat-mesh-v2-examples-polling branch March 24, 2026 07:33
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.

feat: update mesh-v2 examples for polling protocol and new API

1 participant