parseNotificationFrame
Parse an inbound socket frame into a RawPositionNotification, or null when the frame is not a notification (control/ack frames, malformed JSON, or a missing payload — all skipped silently by the caller).
For defilytics, the notification is unwrapped from its { data, address } envelope and the top-level address is hoisted onto the frame.
import { parseNotificationFrame } from "@symmio/trading-core";
const raw = parseNotificationFrame(event.data, "defilytics");
if (raw) {
// a real notification frame
}Parameters
dataunknownrequiredThe raw event.data — a JSON string, or an already-parsed object.
protocolSymmioNotificationsProtocolrequiredThe endpoint’s wire protocol.
Returns
The parsed raw frame, or null for control/ack frames, malformed JSON, or a missing payload.
Related
- normalizeNotification — turns this raw frame into a
Notification. - buildSubscribeMessage — the outbound counterpart sent on connect.
Last updated on