Overview
Producers should receive real-time notifications when their beats are purchased. The backend already streams Horizon contract transactions via SSE — wrap this in a WebSocket endpoint so the frontend and mobile can subscribe to events.
Acceptance Criteria
Implementation
Use the ws package. Integrate with the existing streamContractTransactions service in stellar.ts. Parse Soroban event data to extract the sale details from the contract event topics.
// Suggested event shape
interface SaleEvent {
type: 'sale';
sampleId: number;
tier: 0 | 1 | 2;
buyer: string;
producer: string;
amountXlm: string;
timestamp: string;
}
Overview
Producers should receive real-time notifications when their beats are purchased. The backend already streams Horizon contract transactions via SSE — wrap this in a WebSocket endpoint so the frontend and mobile can subscribe to events.
Acceptance Criteria
GET /wsupgrades to WebSocket connectionsaleevents:{ type: 'sale', sampleId, tier, buyer, amountXlm, timestamp }Implementation
Use the
wspackage. Integrate with the existingstreamContractTransactionsservice instellar.ts. Parse Soroban event data to extract the sale details from the contract event topics.