Ignore:
Timestamp:
11/25/21 22:08:24 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
8d391a1
Parents:
59329aa
Message:

primeNG components

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/node_modules/socket.io/dist/index.d.ts

    r59329aa re29cc2e  
    11/// <reference types="node" />
    22import http = require("http");
    3 import { EventEmitter } from "events";
    4 import { ExtendedError, Namespace } from "./namespace";
     3import { ServerOptions as EngineOptions, AttachOptions } from "engine.io";
     4import { ExtendedError, Namespace, ServerReservedEventsMap } from "./namespace";
    55import { Adapter, Room, SocketId } from "socket.io-adapter";
    66import * as parser from "socket.io-parser";
    77import type { Encoder } from "socket.io-parser";
    88import { Socket } from "./socket";
    9 import type { CookieSerializeOptions } from "cookie";
    10 import type { CorsOptions } from "cors";
    11 declare type Transport = "polling" | "websocket";
     9import type { BroadcastOperator, RemoteSocket } from "./broadcast-operator";
     10import { EventsMap, DefaultEventsMap, EventParams, StrictEventEmitter, EventNames } from "./typed-events";
    1211declare type ParentNspNameMatchFn = (name: string, auth: {
    1312    [key: string]: any;
    1413}, fn: (err: Error | null, success: boolean) => void) => void;
    15 interface EngineOptions {
    16     /**
    17      * how many ms without a pong packet to consider the connection closed
    18      * @default 5000
    19      */
    20     pingTimeout: number;
    21     /**
    22      * how many ms before sending a new ping packet
    23      * @default 25000
    24      */
    25     pingInterval: number;
    26     /**
    27      * how many ms before an uncompleted transport upgrade is cancelled
    28      * @default 10000
    29      */
    30     upgradeTimeout: number;
    31     /**
    32      * how many bytes or characters a message can be, before closing the session (to avoid DoS).
    33      * @default 1e5 (100 KB)
    34      */
    35     maxHttpBufferSize: number;
    36     /**
    37      * A function that receives a given handshake or upgrade request as its first parameter,
    38      * and can decide whether to continue or not. The second argument is a function that needs
    39      * to be called with the decided information: fn(err, success), where success is a boolean
    40      * value where false means that the request is rejected, and err is an error code.
    41      */
    42     allowRequest: (req: http.IncomingMessage, fn: (err: string | null | undefined, success: boolean) => void) => void;
    43     /**
    44      * the low-level transports that are enabled
    45      * @default ["polling", "websocket"]
    46      */
    47     transports: Transport[];
    48     /**
    49      * whether to allow transport upgrades
    50      * @default true
    51      */
    52     allowUpgrades: boolean;
    53     /**
    54      * parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable.
    55      * @default false
    56      */
    57     perMessageDeflate: boolean | object;
    58     /**
    59      * parameters of the http compression for the polling transports (see zlib api docs). Set to false to disable.
    60      * @default true
    61      */
    62     httpCompression: boolean | object;
    63     /**
    64      * what WebSocket server implementation to use. Specified module must
    65      * conform to the ws interface (see ws module api docs). Default value is ws.
    66      * An alternative c++ addon is also available by installing uws module.
    67      */
    68     wsEngine: string;
    69     /**
    70      * an optional packet which will be concatenated to the handshake packet emitted by Engine.IO.
    71      */
    72     initialPacket: any;
    73     /**
    74      * configuration of the cookie that contains the client sid to send as part of handshake response headers. This cookie
    75      * might be used for sticky-session. Defaults to not sending any cookie.
    76      * @default false
    77      */
    78     cookie: CookieSerializeOptions | boolean;
    79     /**
    80      * the options that will be forwarded to the cors module
    81      */
    82     cors: CorsOptions;
    83     /**
    84      * whether to enable compatibility with Socket.IO v2 clients
    85      * @default false
    86      */
    87     allowEIO3: boolean;
    88 }
    89 interface AttachOptions {
    90     /**
    91      * name of the path to capture
    92      * @default "/engine.io"
    93      */
    94     path: string;
    95     /**
    96      * destroy unhandled upgrade requests
    97      * @default true
    98      */
    99     destroyUpgrade: boolean;
    100     /**
    101      * milliseconds after which unhandled requests are ended
    102      * @default 1000
    103      */
    104     destroyUpgradeTimeout: number;
    105 }
    106 interface EngineAttachOptions extends EngineOptions, AttachOptions {
    107 }
    108 interface ServerOptions extends EngineAttachOptions {
     14declare type AdapterConstructor = typeof Adapter | ((nsp: Namespace) => Adapter);
     15interface ServerOptions extends EngineOptions, AttachOptions {
    10916    /**
    11017     * name of the path to capture
     
    12128     * @default the in-memory adapter (https://github.com/socketio/socket.io-adapter)
    12229     */
    123     adapter: any;
     30    adapter: AdapterConstructor;
    12431    /**
    12532     * the parser to use
     
    13340    connectTimeout: number;
    13441}
    135 export declare class Server extends EventEmitter {
    136     readonly sockets: Namespace;
     42export declare class Server<ListenEvents extends EventsMap = DefaultEventsMap, EmitEvents extends EventsMap = ListenEvents, ServerSideEvents extends EventsMap = DefaultEventsMap, SocketData = any> extends StrictEventEmitter<ServerSideEvents, EmitEvents, ServerReservedEventsMap<ListenEvents, EmitEvents, ServerSideEvents, SocketData>> {
     43    readonly sockets: Namespace<ListenEvents, EmitEvents, ServerSideEvents, SocketData>;
     44    /**
     45     * A reference to the underlying Engine.IO server.
     46     *
     47     * Example:
     48     *
     49     * <code>
     50     *   const clientsCount = io.engine.clientsCount;
     51     * </code>
     52     *
     53     */
     54    engine: any;
    13755    /** @private */
    13856    readonly _parser: typeof parser;
     
    14260     * @private
    14361     */
    144     _nsps: Map<string, Namespace>;
     62    _nsps: Map<string, Namespace<ListenEvents, EmitEvents, ServerSideEvents>>;
    14563    private parentNsps;
    14664    private _adapter?;
     
    14866    private opts;
    14967    private eio;
    150     private engine;
    15168    private _path;
    15269    private clientPathRegex;
     
    187104    _checkNamespace(name: string, auth: {
    188105        [key: string]: any;
    189     }, fn: (nsp: Namespace | false) => void): void;
     106    }, fn: (nsp: Namespace<ListenEvents, EmitEvents, ServerSideEvents> | false) => void): void;
    190107    /**
    191108     * Sets the client serving path.
     
    213130     * @public
    214131     */
    215     adapter(): typeof Adapter | undefined;
    216     adapter(v: typeof Adapter): this;
    217     adapter(v?: typeof Adapter): typeof Adapter | undefined | this;
     132    adapter(): AdapterConstructor | undefined;
     133    adapter(v: AdapterConstructor): this;
    218134    /**
    219135     * Attaches socket.io to a server or port.
     
    234150     */
    235151    attach(srv: http.Server | number, opts?: Partial<ServerOptions>): this;
     152    attachApp(app: any, opts?: Partial<ServerOptions>): void;
    236153    /**
    237154     * Initialize engine
     
    287204     * @public
    288205     */
    289     of(name: string | RegExp | ParentNspNameMatchFn, fn?: (socket: Socket) => void): Namespace;
     206    of(name: string | RegExp | ParentNspNameMatchFn, fn?: (socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>) => void): Namespace<ListenEvents, EmitEvents, ServerSideEvents>;
    290207    /**
    291208     * Closes server connection
     
    301218     * @public
    302219     */
    303     use(fn: (socket: Socket, next: (err?: ExtendedError) => void) => void): this;
     220    use(fn: (socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, next: (err?: ExtendedError) => void) => void): this;
    304221    /**
    305222     * Targets a room when emitting.
    306223     *
     224     * @param room
     225     * @return self
     226     * @public
     227     */
     228    to(room: Room | Room[]): BroadcastOperator<EmitEvents>;
     229    /**
     230     * Targets a room when emitting.
     231     *
     232     * @param room
     233     * @return self
     234     * @public
     235     */
     236    in(room: Room | Room[]): BroadcastOperator<EmitEvents>;
     237    /**
     238     * Excludes a room when emitting.
     239     *
    307240     * @param name
    308241     * @return self
    309242     * @public
    310243     */
    311     to(name: Room): this;
    312     /**
    313      * Targets a room when emitting.
    314      *
    315      * @param name
    316      * @return self
    317      * @public
    318      */
    319     in(name: Room): this;
     244    except(name: Room | Room[]): BroadcastOperator<EmitEvents>;
    320245    /**
    321246     * Sends a `message` event to all clients.
     
    324249     * @public
    325250     */
    326     send(...args: readonly any[]): this;
     251    send(...args: EventParams<EmitEvents, "message">): this;
    327252    /**
    328253     * Sends a `message` event to all clients.
     
    331256     * @public
    332257     */
    333     write(...args: readonly any[]): this;
     258    write(...args: EventParams<EmitEvents, "message">): this;
     259    /**
     260     * Emit a packet to other Socket.IO servers
     261     *
     262     * @param ev - the event name
     263     * @param args - an array of arguments, which may include an acknowledgement callback at the end
     264     * @public
     265     */
     266    serverSideEmit<Ev extends EventNames<ServerSideEvents>>(ev: Ev, ...args: EventParams<ServerSideEvents, Ev>): boolean;
    334267    /**
    335268     * Gets a list of socket ids.
     
    345278     * @public
    346279     */
    347     compress(compress: boolean): this;
     280    compress(compress: boolean): BroadcastOperator<EmitEvents>;
    348281    /**
    349282     * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
     
    354287     * @public
    355288     */
    356     get volatile(): this;
     289    get volatile(): BroadcastOperator<EmitEvents>;
    357290    /**
    358291     * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
     
    361294     * @public
    362295     */
    363     get local(): this;
     296    get local(): BroadcastOperator<EmitEvents>;
     297    /**
     298     * Returns the matching socket instances
     299     *
     300     * @public
     301     */
     302    fetchSockets(): Promise<RemoteSocket<EmitEvents>[]>;
     303    /**
     304     * Makes the matching socket instances join the specified rooms
     305     *
     306     * @param room
     307     * @public
     308     */
     309    socketsJoin(room: Room | Room[]): void;
     310    /**
     311     * Makes the matching socket instances leave the specified rooms
     312     *
     313     * @param room
     314     * @public
     315     */
     316    socketsLeave(room: Room | Room[]): void;
     317    /**
     318     * Makes the matching socket instances disconnect
     319     *
     320     * @param close - whether to close the underlying connection
     321     * @public
     322     */
     323    disconnectSockets(close?: boolean): void;
    364324}
    365 export { Socket, ServerOptions, Namespace };
     325export { Socket, ServerOptions, Namespace, BroadcastOperator, RemoteSocket };
Note: See TracChangeset for help on using the changeset viewer.