Skip to docs content
Home
Reference

WebSocket Events

The current Socket.IO event contract implemented by Fusion's WebSocket server.

Fusion's WebSocket server is a Socket.IO server.

This page documents the events actually emitted by the backend.

Client-to-server events

Event Payload Notes
subscribe:intent intentId: string Joins the room for a specific intent. If the intent already exists, the server immediately emits intent:status.
unsubscribe:intent intentId: string Leaves a specific intent room.
subscribe:all none Joins the admin-style all-intents room and immediately receives mempool:stats.
unsubscribe:all none Leaves the all-intents room.
ping none Used for heartbeat; the server replies with pong.

Server-to-client events

intent:status

Primary per-intent update payload.

Current fields:

  • intentId
  • status
  • proofStatus
  • solver
  • fromChain
  • toChain
  • amount
  • createdAt
  • updatedAt
  • matchedAt
  • completedAt
  • htlcState
  • txHashes
  • error
  • failureReason
  • timestamp

The status value is already normalized for frontend use. Common values include:

  • proofs_pending
  • proofs_verified
  • matched
  • waiting_for_source_lock
  • executing
  • completed
  • failed

intent:proof

Current fields:

  • intentId
  • proofStatus
  • oldProofStatus
  • proofGeneratedAt
  • timestamp

intent:new

Broadcast to subscribe:all listeners when a new intent is added.

Payload shape matches the same formatted intent update used for intent:status.

intent:status_changed

Broadcast to subscribe:all listeners when the internal intent status changes.

Current fields:

  • the formatted intent update fields
  • oldStatus

Note that oldStatus comes from the backend's internal enum, not the normalized frontend status string.

intent:proof_changed

Broadcast to subscribe:all listeners when proof status changes.

Current fields:

  • intentId
  • proofStatus
  • oldProofStatus
  • proofGeneratedAt
  • timestamp

intent:removed

Current fields:

  • intentId
  • timestamp

intent:not_found

Current fields:

  • intentId

mempool:stats

Current fields:

  • total
  • submitted
  • matched
  • executing
  • completed
  • failed
  • cancelled

pong

Current fields:

  • timestamp

error

Used for invalid client payloads such as a bad intentId.

Important scope note

Some clients also listen for intent:settlement_proof.

As of today, that event is not emitted by the backend WebSocket server. If you are building a client, treat the events on this page as the implemented server contract.

Minimal subscription example

import { io } from 'socket.io-client';

const socket = io(BACKEND_URL, {
  transports: ['websocket', 'polling'],
});

socket.on('connect', () => {
  socket.emit('subscribe:intent', intentId);
});

socket.on('intent:status', (update) => {
  console.log(update.status, update.proofStatus, update.txHashes);
});

Related docs: