aws-crt
Version:
NodeJS/browser bindings to the aws-c-* libraries
53 lines (52 loc) • 2.56 kB
TypeScript
/// <reference types="node" />
/**
* @packageDocumentation
*/
import * as event from "./event";
/**
* Converts payload to Buffer or string regardless of the supplied type
* @param payload The payload to convert
* @internal
*/
export declare function normalize_payload(payload: any): Buffer | string;
/**
* Converts payload to Buffer only, regardless of the supplied type
* @param payload The payload to convert
* @internal
*/
export declare function normalize_payload_to_buffer(payload: any): Buffer;
/** @internal */
export declare const DEFAULT_KEEP_ALIVE: number;
export declare function isValidTopicFilter(topicFilter: any): boolean;
export declare function isValidTopic(topic: any): boolean;
export type PublishAcknowledgementFunctor = () => void;
/**
* Wrapper class containing a one-use singleton handle that can be used to trigger sending the acknowledgement (Puback in
* QoS 1, Pubrec in QoS 2) packet for an incoming publish.
*/
export declare class PublishAcknowledgementHandleWrapper {
private ackHandle;
constructor(handle: PublishAcknowledgementHandle | null);
/**
* Attempt to take the acknowledgement handle held by the wrapper. This will only succeed for the first caller;
* after the initial call, null will be returned. By taking the handle, the caller assumes responsibility
* for sending the acknowledgement packet associated with the incoming publish packet. Failing to trigger the
* acknowledgement will cause the broker to potentially re-send the publish.
*/
acquireHandle(): PublishAcknowledgementHandle | null;
}
/** @internal */
export declare function emitAcknowledgeableEvent<T>(emitter: event.BufferedEventEmitter, ackEvent: string, ackEventPayload: T, wrapperFieldName: string, ackHandleWrapper?: PublishAcknowledgementHandleWrapper, compositionFunctor?: PublishAcknowledgementFunctor): void;
/** @internal */
export declare function queueAcknowledgeableEvent<T>(emitter: event.BufferedEventEmitter, ackEvent: string, ackEventPayload: T, wrapperFieldName: string, ackHandleWrapper?: PublishAcknowledgementHandleWrapper, compositionFunctor?: PublishAcknowledgementFunctor): void;
/**
* Object that allows the holder to trigger the acknowledgement for an associated publish packet.
*/
export declare class PublishAcknowledgementHandle {
private acknowledgementFunction?;
constructor(acknowledgementFunction: PublishAcknowledgementFunctor);
/**
* trigger the acknowledgement for an associated Publish packet
*/
invokeAcknowledgement(): void;
}