UNPKG

1.11 kBTypeScriptView Raw
1import { IFrame } from './i-frame.js';
2import { StompHeaders } from './stomp-headers.js';
3/**
4 * Instance of Message will be passed to [subscription callback]{@link Client#subscribe}
5 * and [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
6 * Since it is an extended {@link IFrame}, you can access [headers]{@link IFrame#headers}
7 * and [body]{@link IFrame#body} as properties.
8 *
9 * Part of `@stomp/stompjs`.
10 *
11 * See [Client#subscribe]{@link Client#subscribe} for example.
12 */
13export interface IMessage extends IFrame {
14 /**
15 * When subscribing with manual acknowledgement, call this method on the message to ACK the message.
16 *
17 * See [Client#ack]{@link Client#ack} for an example.
18 */
19 ack: (headers?: StompHeaders) => void;
20 /**
21 * When subscribing with manual acknowledgement, call this method on the message to NACK the message.
22 *
23 * See [Client#nack]{@link Client#nack} for an example.
24 */
25 nack: (headers?: StompHeaders) => void;
26}
27/**
28 * Aliased to {@link IMessage}.
29 *
30 * Part of `@stomp/stompjs`.
31 */
32export declare type Message = IMessage;