buildSubscribeMessage
Build the subscribe frame to send on (re)connect for a notifications endpoint.
For enigma, this is a channel_patterns frame scoped to the account with wildcard identifiers (every quote id for the account). The frame is returned as a JSON string, ready to send.
The rasa protocol has its own builder, buildRasaSubscribeMessage(addresses): one socket carries many SubAccounts, so its frame is just the full address list — { "address": ["0x…", …] }. watchNotifications manages that list for you; reach for the builder only when driving a raw socket yourself.
import { buildRasaSubscribeMessage, buildSubscribeMessage } from "@symmio/trading-core";
const frame = buildSubscribeMessage({
account: "0xaccount...",
channel: "Hyper-EVM_Solver-Low-Cap_Production",
protocol: "enigma",
});
const rasaFrame = buildRasaSubscribeMessage(["0xaccount..."]);
// '{"address":["0xaccount..."]}'Parameters
The single argument is a BuildSubscribeMessageParameters object:
accountAddressrequiredSubAccount address to subscribe for.
channelstringrequiredChannel / app_name configured for the endpoint.
protocolSymmioNotificationsProtocolrequiredWire protocol the endpoint speaks.
Returns
stringThe frame serialized as a JSON string, ready to send. Throws a SymmError for an unsupported protocol.
Related
- parseNotificationFrame — the inbound counterpart.
- watchNotifications — sends this frame on every (re)connect.