eventsSocketServer.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /// <reference types="node" />
  2. import { Server as HttpServer } from 'http';
  3. import { Server as HttpsServer } from 'https';
  4. import messageSocketModule from './messageSocketServer';
  5. /**
  6. * The eventsSocket websocket listens at the 'events/` for websocket
  7. * connections, on which all Metro reports will be emitted.
  8. *
  9. * This is mostly useful for developer tools (clients) that wants to monitor Metro,
  10. * and the apps connected to Metro.
  11. *
  12. * The eventsSocket provides the following features:
  13. * - it reports any Metro event (that is reported through a reporter) to all clients
  14. * - it reports any console.log's (and friends) from the connected app to all clients
  15. * (as client_log event)
  16. * - it allows connected clients to send commands through Metro to the connected app.
  17. * This reuses the generic command mechanism.
  18. * Two useful commands are 'reload' and 'devmenu'.
  19. */
  20. declare type Server = HttpServer | HttpsServer;
  21. declare type MessageSocket = ReturnType<typeof messageSocketModule.attachToServer>;
  22. /**
  23. * Starts the eventsSocket at the given path
  24. *
  25. * @param server
  26. * @param path typically: 'events/'
  27. * @param messageSocket: webSocket to which all connected RN apps are listening
  28. */
  29. declare function attachToServer(server: Server, path: string, messageSocket: MessageSocket): {
  30. reportEvent: (event: any) => void;
  31. };
  32. declare const _default: {
  33. attachToServer: typeof attachToServer;
  34. };
  35. export default _default;
  36. //# sourceMappingURL=eventsSocketServer.d.ts.map