mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-28 13:13:37 +08:00
Fixed: 365626812 Change-Id: I1e4711a43fa31bff35b45ac6e6dd518391db562e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5939693 Reviewed-by: Danil Somsikov <dsv@chromium.org> Auto-Submit: Alex Rudenko <alexrudenko@chromium.org> Commit-Queue: Danil Somsikov <dsv@chromium.org> Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
120 lines
2.8 KiB
TypeScript
120 lines
2.8 KiB
TypeScript
import { Packet } from "socket.io-parser";
|
|
import type { IncomingMessage } from "http";
|
|
import type { Server } from "./index";
|
|
import type { EventsMap } from "./typed-events";
|
|
import type { Socket } from "./socket";
|
|
import type { Socket as RawSocket } from "engine.io";
|
|
interface WriteOptions {
|
|
compress?: boolean;
|
|
volatile?: boolean;
|
|
preEncoded?: boolean;
|
|
wsPreEncoded?: string;
|
|
}
|
|
export declare class Client<ListenEvents extends EventsMap, EmitEvents extends EventsMap, ServerSideEvents extends EventsMap, SocketData = any> {
|
|
readonly conn: RawSocket;
|
|
private readonly id;
|
|
private readonly server;
|
|
private readonly encoder;
|
|
private readonly decoder;
|
|
private sockets;
|
|
private nsps;
|
|
private connectTimeout?;
|
|
/**
|
|
* Client constructor.
|
|
*
|
|
* @param server instance
|
|
* @param conn
|
|
* @package
|
|
*/
|
|
constructor(server: Server<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, conn: any);
|
|
/**
|
|
* @return the reference to the request that originated the Engine.IO connection
|
|
*
|
|
* @public
|
|
*/
|
|
get request(): IncomingMessage;
|
|
/**
|
|
* Sets up event listeners.
|
|
*
|
|
* @private
|
|
*/
|
|
private setup;
|
|
/**
|
|
* Connects a client to a namespace.
|
|
*
|
|
* @param {String} name - the namespace
|
|
* @param {Object} auth - the auth parameters
|
|
* @private
|
|
*/
|
|
private connect;
|
|
/**
|
|
* Connects a client to a namespace.
|
|
*
|
|
* @param name - the namespace
|
|
* @param {Object} auth - the auth parameters
|
|
*
|
|
* @private
|
|
*/
|
|
private doConnect;
|
|
/**
|
|
* Disconnects from all namespaces and closes transport.
|
|
*
|
|
* @private
|
|
*/
|
|
_disconnect(): void;
|
|
/**
|
|
* Removes a socket. Called by each `Socket`.
|
|
*
|
|
* @private
|
|
*/
|
|
_remove(socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>): void;
|
|
/**
|
|
* Closes the underlying connection.
|
|
*
|
|
* @private
|
|
*/
|
|
private close;
|
|
/**
|
|
* Writes a packet to the transport.
|
|
*
|
|
* @param {Object} packet object
|
|
* @param {Object} opts
|
|
* @private
|
|
*/
|
|
_packet(packet: Packet | any[], opts?: WriteOptions): void;
|
|
private writeToEngine;
|
|
/**
|
|
* Called with incoming transport data.
|
|
*
|
|
* @private
|
|
*/
|
|
private ondata;
|
|
/**
|
|
* Called when parser fully decodes a packet.
|
|
*
|
|
* @private
|
|
*/
|
|
private ondecoded;
|
|
/**
|
|
* Handles an error.
|
|
*
|
|
* @param {Object} err object
|
|
* @private
|
|
*/
|
|
private onerror;
|
|
/**
|
|
* Called upon transport close.
|
|
*
|
|
* @param reason
|
|
* @param description
|
|
* @private
|
|
*/
|
|
private onclose;
|
|
/**
|
|
* Cleans up event listeners.
|
|
* @private
|
|
*/
|
|
private destroy;
|
|
}
|
|
export {};
|