UNPKG

948 BTypeScriptView Raw
1import { EventEmitter } from "events";
2
3import { Channel } from "./channel";
4import { Connection } from "./connection";
5import { Record } from "./record";
6import { Topic } from "./topic";
7
8export interface StreamingMessage {
9 event: {
10 type: string;
11 createdDate: string;
12 replayId?: number | undefined;
13 };
14 sobject: Record;
15}
16
17export class Streaming extends EventEmitter {
18 constructor(connection: Connection);
19
20 channel(channelId: string): Channel;
21 subscribe(name: string, listener: StreamingMessage): any; // Faye Subscription
22 topic(name: string): Topic;
23 unsubscribe(name: string, listener: StreamingMessage): Streaming;
24 createClient(extensions?: any[]): any; // Faye Client
25}
26
27export namespace StreamingExtension {
28 export class Replay {
29 constructor(channel: string, replayId: number);
30 }
31 export class AuthFailure {
32 constructor(failureCallback: () => any);
33 }
34}