Skip to content
Velo

channels.raw

Builds a channel from its wire name. The listener receives the server's payload as unknown, even when the name matches a built-in indicator.

Imports

import { Velo } from 'velo-sdk';

Example

const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
 
const raw = velo.channels.raw('realtime_binance-futures:BTCUSDT').on({
  data: (payload, message) => console.log(payload, message.frame),
  error: ({ reason }) => console.error('Raw channel error:', reason),
});
 
const watcher = await velo.watch(velo.channels.feed([raw]), {
  on: { error: (error) => console.error('Connection error:', error) },
});
 
// Later:
watcher.close();

Use channels.price() when you want this channel decoded into named price and volume fields.

Definition

function raw(name: string): RawChannel;

Parameters

name

  • Type: string
  • Required

The exact channel name sent to the server. It must be non-empty and contain no surrounding whitespace or control characters. Validating the name does not confirm that the server publishes it.

A raw channel and a typed channel with the same wire name have different kind values and cannot share one watcher.

Return Type

  • Type: RawChannel

Returns a channel with payload data typed as unknown.

The payload is the frame's d field, unchanged, or undefined when absent. Use message.frame to access the complete server frame.