Skip to content
This repository was archived by the owner on Oct 12, 2024. It is now read-only.

Commit d3cc56c

Browse files
committed
docs: add some notes
1 parent e3524a4 commit d3cc56c

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

projects/ngx-socketio2/src/lib/socketio.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ import { ManagerOptions, SocketOptions } from 'socket.io-client';
22

33
export interface SocketioConfig {
44
url: string,
5+
/** @see {@link ManagerOptions} */
56
options?: Partial<SocketOptions & ManagerOptions>
67
}

projects/ngx-socketio2/src/lib/socketio.service.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,36 @@ export class Socketio implements OnDestroy {
1010
private subject: Subject<{ eventName: string, args: any[] }> = new Subject();
1111
private socket: Socket;
1212

13+
/**
14+
* @see {@link Socket.id}
15+
*/
1316
get id(): string { return this.socket.id };
17+
18+
/**
19+
* @see {@link Socket.connected}
20+
*/
1421
get connected(): boolean { return this.socket.connected };
22+
23+
/**
24+
* @see {@link Socket.disconnected}
25+
*/
1526
get disconnected(): boolean { return this.socket.disconnected };
27+
28+
/**
29+
* @see {@link Socket.io}
30+
*/
1631
get io(): Manager { return this.socket.io };
32+
33+
/**
34+
* @see {@link Socket.auth}
35+
*/
1736
get auth(): Socket['auth'] { return this.socket.auth };
1837

38+
/**
39+
* @see {@link Socketio.auth}
40+
*/
41+
set auth(auth: Socket['auth']) { this.auth = auth };
42+
1943
constructor(
2044
@Inject(SOCKETIO_CONFIG) { url, options }: SocketioConfig
2145
) {
@@ -30,27 +54,45 @@ export class Socketio implements OnDestroy {
3054
this.subject.complete();
3155
}
3256

57+
/**
58+
* @see {@link Socket.connect}
59+
*/
3360
connect(): this {
3461
this.socket.connect();
3562
return this;
3663
}
3764

65+
/**
66+
* @see {@link Socket.disconnect}
67+
*/
3868
disconnect(): this {
3969
this.socket.disconnect();
4070
return this;
4171
}
4272

73+
/**
74+
* @see {@link Socket.send}
75+
*/
4376
send(...args: any[]): this {
4477
this.socket.send(...args);
4578
return this;
4679
}
4780

81+
/**
82+
* @see {@link Socket.emit}
83+
*/
4884
emit(eventName: string, ...args: any[]): this {
4985
this.socket.emit(eventName, ...args);
5086
return this;
5187
}
5288

89+
/**
90+
* @see {@link Socket.onAny}
91+
*/
5392
on<T>(): Observable<{ eventName: string, args: T }>
93+
/**
94+
* @see {@link Socket.on}
95+
*/
5496
on<T>(eventName?: string): Observable<T>
5597
on<T extends any>(eventName?: string): Observable<T> | Observable<{ eventName: string, args: T }> {
5698
const observable = this.subject.asObservable();
@@ -67,10 +109,16 @@ export class Socketio implements OnDestroy {
67109
);
68110
}
69111

112+
/**
113+
* @see {@link Socket.once}
114+
*/
70115
once<T>(eventName: string): Observable<T> {
71116
return this.on<T>(eventName).pipe(take(1));
72117
}
73118

119+
/**
120+
* @see {@link Socket.compress}
121+
*/
74122
compress(compress: boolean): this {
75123
this.socket.compress(compress);
76124
return this;

0 commit comments

Comments
 (0)