WebSocketSubject.d.ts
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { AnonymousSubject } from '../../Subject';
import { Subscriber } from '../../Subscriber';
import { Observable } from '../../Observable';
import { Subscription } from '../../Subscription';
import { Operator } from '../../Operator';
import { Observer, NextObserver } from '../../Observer';
export interface WebSocketSubjectConfig {
url: string;
protocol?: string | Array<string>;
resultSelector?: <T>(e: MessageEvent) => T;
openObserver?: NextObserver<Event>;
closeObserver?: NextObserver<CloseEvent>;
closingObserver?: NextObserver<void>;
WebSocketCtor?: {
new (url: string, protocol?: string | Array<string>): WebSocket;
};
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
export declare class WebSocketSubject<T> extends AnonymousSubject<T> {
url: string;
protocol: string | Array<string>;
socket: WebSocket;
openObserver: NextObserver<Event>;
closeObserver: NextObserver<CloseEvent>;
closingObserver: NextObserver<void>;
WebSocketCtor: {
new (url: string, protocol?: string | Array<string>): WebSocket;
};
private _output;
resultSelector(e: MessageEvent): any;
/**
* @param urlConfigOrSource
* @return {WebSocketSubject}
* @static true
* @name webSocket
* @owner Observable
*/
static create<T>(urlConfigOrSource: string | WebSocketSubjectConfig): WebSocketSubject<T>;
constructor(urlConfigOrSource: string | WebSocketSubjectConfig | Observable<T>, destination?: Observer<T>);
lift<R>(operator: Operator<T, R>): WebSocketSubject<R>;
private _resetState();
multiplex(subMsg: () => any, unsubMsg: () => any, messageFilter: (value: T) => boolean): Observable<{}>;
private _connectSocket();
protected _subscribe(subscriber: Subscriber<T>): Subscription;
unsubscribe(): void;
}