Skip to main content
Mobula’s Pulse V2 WebSocket stream delivers real-time token data — new pairs, bonding curve progress, and migrations — directly to your application. This guide shows you how to integrate the Pulse WSS using the @mobula/sdk, with practical patterns taken from the open-source MTT (Mobula Trader Terminal) codebase.
Live Demo: See Pulse in action at mtt.ggSource Code: Full implementation at github.com/MobulaFi/MTT

Prerequisites

  • Node.js 18+ or Bun
  • A Mobula API key (Growth or Enterprise plan) — get one at admin.mobula.io
  • @mobula/sdk installed in your project

Quick Start

Connect to Pulse V2 and start receiving real-time token data in under 10 lines:
That’s it — you’re now receiving live token updates.

How the SDK StreamClient Works

The MobulaClient exposes a streams property — an instance of StreamClient that manages WebSocket connections. Key behaviors:

Core Methods


Understanding the Payload

The subscription payload controls what data you receive. Here’s the full shape:

View Models


Message Types

The stream sends three message types:

init — Initial Data Snapshot

Sent immediately after subscribing. Contains the current state for all views:

update-token — Token Data Changed

Sent when a token’s metrics update (price, holders, market cap, etc.):

new-token — New Token Appeared

Sent when a token enters a view for the first time:

REST + WebSocket Pattern

MTT uses a REST-first, WebSocket-second pattern for the best user experience: load data instantly via REST, then switch to WebSocket for live updates. Here’s a simplified version of how MTT does it (apps/mtt/src/features/pulse/hooks/usePulseV2.ts):
The REST and WebSocket APIs accept the same payload shape, so you can reuse your view configuration for both.

How MTT Implements Pulse WSS

MTT is Mobula’s open-source trading terminal. Its Pulse implementation is a production reference you can study and adapt. Here are the key architectural pieces:

Architecture

Key Files in the MTT Codebase

SDK Client Wrapper

MTT wraps the SDK to support both server-side (SSR) and client-side modes. Here’s the stream subscription pattern from sdkClient.ts:

Update Batching for 60fps

MTT batches incoming WebSocket messages using requestAnimationFrame to avoid render storms:
Without batching, high-frequency token updates can cause hundreds of React re-renders per second. The UpdateBatcher coalesces them into a single render per animation frame.

Pause and Resume

The SDK supports pausing specific views without disconnecting:
MTT uses this when the user scrolls away from a section or when applying filters (to prevent flickering during resubscription):

Filtering

Pass filters inside each view to narrow down the token stream. Filters use { gte, lte } range syntax:

Available Filter Fields

For the complete filter reference with examples, see Filter Details.

Multi-Chain Support

Subscribe to multiple chains in a single view:
Or use separate views per chain for independent control:

Custom WSS URLs

The SDK lets you override WebSocket endpoints per stream type:
MTT uses this to allow users to configure custom endpoints from the UI (stored in localStorage).

Unsubscribing and Cleanup

Always clean up subscriptions when your component unmounts or when you no longer need the data:
In React, handle this in a cleanup function:

Full React Example

Here’s a minimal but complete React hook for Pulse V2, inspired by MTT’s implementation:

Next Steps

Pulse V2 API Reference

Full API reference with all parameters and response schemas

Filter Details

Complete filter reference with operators and examples

Build Full Pulse UI

Step-by-step guide to building a complete Pulse UI with Next.js

MTT Source Code

Explore the full open-source trading terminal