Skip to content

Update sockethub integration for latest API#305

Open
silverbucket wants to merge 3 commits intochore/upgrade_emberfrom
silverbucket/sockethub-update
Open

Update sockethub integration for latest API#305
silverbucket wants to merge 3 commits intochore/upgrade_emberfrom
silverbucket/sockethub-update

Conversation

@silverbucket
Copy link
Copy Markdown
Member

@silverbucket silverbucket commented Mar 29, 2026

Summary

  • Replace CDN-loaded sockethub scripts with @sockethub/client@^5.0.0-alpha.12 and socket.io-client npm packages
  • Adapt to the new client lifecycle: ready() initialization, contextFor() for dynamic @context arrays, platform schema validation
  • Use @context arrays from server registry instead of the context string property on outgoing messages
  • Wrap actor and target as objects with id and type properties
  • IRC channel IDs now use channel@hostname format (was hostname/channel)
  • Add completed, failed, and client_error event listeners for proper job status tracking
  • Resolve platform from @context for incoming message routing via platformForMessage()
  • Refactor transferMeMessage to accept channel object directly (consistent with transferMessage)
  • Remove deprecated observe handler and ActivityStreams.Object.create() pre-registration calls
  • Fix pre-existing XMPP log type bug in credential error handling

Test plan

  • All unit tests pass (101/101)
  • Production build succeeds
  • XMPP connect, join, send, and receive verified manually
  • IRC connect, join, send, and receive
  • Verify configure-sockethub screen shows when server is unreachable

Replace CDN-loaded scripts with @sockethub/client and socket.io-client
npm packages. Adapt to the new client lifecycle (ready(), contextFor(),
platform schema validation) and ActivityStreams message format:

- Use @context arrays from server registry instead of context property
- Wrap actor/target as objects with id and type
- IRC channel IDs now use channel@hostname format
- Add completed/failed/client_error event listeners
- Resolve platform from @context for incoming message routing
- Refactor transferMeMessage to accept channel object directly
- Remove deprecated observe handler and ActivityStreams.Object.create
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Hyperchannel’s Sockethub integration to use the latest client API shipped via npm packages, and adapts message/job handling to the new @context/lifecycle model.

Changes:

  • Replaces CDN-loaded Sockethub client usage with @sockethub/client + socket.io-client, and updates initialization (ready()).
  • Updates IRC/XMPP transport services to emit jobs using @context arrays and structured actor/target objects; updates IRC channel ID format.
  • Adds handling for Sockethub job lifecycle events (completed, failed, client_error) and routes incoming messages based on @context.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/services/sockethub-xmpp-test.js Updates unit tests to reflect the new @context job format and removes pre-registration assumptions.
package.json Adds @sockethub/client and socket.io-client dependencies.
package-lock.json Locks new Sockethub and Socket.IO client dependency graph.
app/services/sockethub.js Migrates to npm-based Sockethub client initialization and adds contextFor() / platformForMessage() helpers.
app/services/sockethub-xmpp.js Refactors XMPP job payloads to the new schema (@context, structured actor/target).
app/services/sockethub-irc.js Refactors IRC job payloads to the new schema and adapts to the new IRC channel ID format.
app/services/coms.js Adds job lifecycle listeners and routes incoming messages using platform derived from @context.
app/models/base_channel.js Updates IRC Sockethub channel ID format to channel@hostname.
app/controllers/base_channel.js Updates /me command path to use the refactored transferMeMessage signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add early return with console.warn in handleSockethubMessage and
  handleJobCompleted when platformForMessage returns undefined
- Switch double quotes to single quotes in test target objects
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Skip join dispatch in handleJobCompleted since per-emit callbacks
  in sockethub-irc/xmpp.join() already handle it
- Normalize XMPP credentials callback to extract msg.error like IRC,
  preventing false failure logs on object acks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants