ngx-socketio2-updated
Version:
A better Socket.IO module for Angular.
81 lines (76 loc) • 2.36 kB
TypeScript
import * as i0 from '@angular/core';
import { ModuleWithProviders, OnDestroy } from '@angular/core';
import { SocketOptions, ManagerOptions, Manager, Socket as Socket$1 } from 'socket.io-client';
import { Observable } from 'rxjs';
import { EventsMap, DefaultEventsMap, EventNames, EventParams } from '@socket.io/component-emitter';
interface SocketioConfig {
url: string;
/** @see {@link ManagerOptions} */
options?: Partial<SocketOptions & ManagerOptions>;
}
declare class SocketioModule {
static forRoot(config?: SocketioConfig): ModuleWithProviders<SocketioModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<SocketioModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<SocketioModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<SocketioModule>;
}
declare class Socket<ListenEvents extends EventsMap = DefaultEventsMap, EmitEvents extends EventsMap = ListenEvents> implements OnDestroy {
private socket;
/**
* @see {@link Socket.id}
*/
get id(): string | undefined;
/**
* @see {@link Socket.connected}
*/
get connected(): boolean;
/**
* @see {@link Socket.disconnected}
*/
get disconnected(): boolean;
/**
* @see {@link Socket.io}
*/
get io(): Manager;
/**
* @see {@link Socket.auth}
*/
get auth(): Socket$1['auth'];
/**
* @see {@link Socket.auth}
*/
set auth(auth: Socket$1['auth']);
constructor({ url, options }: SocketioConfig);
ngOnDestroy(): void;
/**
* @see {@link Socket.connect}
*/
connect(): this;
/**
* @see {@link Socket.disconnect}
*/
disconnect(): this;
/**
* @see {@link Socket.send}
*/
send(...args: any[]): this;
/**
* @see {@link Socket.emit}
*/
emit<Ev extends EventNames<EmitEvents>>(eventName: Ev, ...args: EventParams<EmitEvents, Ev>): this;
/**
* @see {@link Socket.on}
*/
on<T>(eventName: string): Observable<T>;
/**
* @see {@link Socket.once}
*/
once<T>(eventName: string): Observable<T>;
/**
* @see {@link Socket.compress}
*/
compress(compress: boolean): this;
static ɵfac: i0.ɵɵFactoryDeclaration<Socket<any, any>, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<Socket<any, any>>;
}
export { Socket, SocketioModule };