This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

36 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-04-02 02:24:13 +03:00
/// <reference types="node" />
import { Server as HttpServer } from 'http';
import { Server as HttpsServer } from 'https';
import messageSocketModule from './messageSocketServer';
/**
* The eventsSocket websocket listens at the 'events/` for websocket
* connections, on which all Metro reports will be emitted.
*
* This is mostly useful for developer tools (clients) that wants to monitor Metro,
* and the apps connected to Metro.
*
* The eventsSocket provides the following features:
* - it reports any Metro event (that is reported through a reporter) to all clients
* - it reports any console.log's (and friends) from the connected app to all clients
* (as client_log event)
* - it allows connected clients to send commands through Metro to the connected app.
* This reuses the generic command mechanism.
* Two useful commands are 'reload' and 'devmenu'.
*/
declare type Server = HttpServer | HttpsServer;
declare type MessageSocket = ReturnType<typeof messageSocketModule.attachToServer>;
/**
* Starts the eventsSocket at the given path
*
* @param server
* @param path typically: 'events/'
* @param messageSocket: webSocket to which all connected RN apps are listening
*/
declare function attachToServer(server: Server, path: string, messageSocket: MessageSocket): {
reportEvent: (event: any) => void;
};
declare const _default: {
attachToServer: typeof attachToServer;
};
export default _default;
//# sourceMappingURL=eventsSocketServer.d.ts.map