@hsaadawy/ngx-chat
Version:
43 lines (42 loc) • 1.73 kB
TypeScript
import { NgZone } from '@angular/core';
import { Client } from '@xmpp/client';
import { JID } from '@xmpp/jid';
import { Element } from 'ltx';
import { BehaviorSubject, Subject } from 'rxjs';
import { LogInRequest } from '../../../core/log-in-request';
import { IqResponseStanza, Stanza } from '../../../core/stanza';
import { LogService } from '../../log.service';
import { XmppClientFactoryService } from './xmpp-client-factory.service';
export declare type XmppChatStates = 'disconnected' | 'online' | 'reconnecting';
/**
* Implementation of the XMPP specification according to RFC 6121.
* @see https://xmpp.org/rfcs/rfc6121.html
* @see https://xmpp.org/rfcs/rfc3920.html
* @see https://xmpp.org/rfcs/rfc3921.html
*/
export declare class XmppChatConnectionService {
private readonly logService;
private readonly ngZone;
private readonly xmppClientFactoryService;
readonly state$: BehaviorSubject<XmppChatStates>;
readonly stanzaUnknown$: Subject<Stanza>;
/**
* User JID with resource, not bare.
*/
userJid?: JID;
private iqId;
private readonly iqStanzaResponseHandlers;
client?: Client;
constructor(logService: LogService, ngZone: NgZone, xmppClientFactoryService: XmppClientFactoryService);
onOnline(jid: JID): void;
sendPresence(): Promise<void>;
send(content: any): Promise<void>;
sendIq(request: Element): Promise<IqResponseStanza<'result'>>;
sendIqAckResult(id: string): Promise<void>;
onStanzaReceived(stanza: Stanza): void;
private isIqStanzaResponse;
logIn(logInRequest: LogInRequest): Promise<void>;
logOut(): Promise<void>;
getNextIqId(): string;
reconnectSilently(): void;
}