UNPKG

dt-app

Version:

The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.

34 lines (33 loc) 1.74 kB
import type { FastifyInstance } from 'fastify'; import type { ServerOptions } from '../utils/config/cli-options'; /** * Path on the dev server reserved for the internal live-reload / error-reporting * websocket. Every other websocket upgrade is proxied to the platform. * * The leading prefix is unlikely to collide with any real app route. */ export declare const DEV_SERVER_LIVE_RELOAD_PATH = "/__dt_app_live_reload__"; /** * Creates a new Fastify instance * @param options * @returns */ export declare function createHttpServer(options: ServerOptions): FastifyInstance<import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>; /** * Creates the internal WebSocket server used for live-reload and error reporting. * * It is deliberately created with `noServer: true` so that it does NOT attach a * listener to the HTTP server's `upgrade` event for *every* path. Binding it * directly to the HTTP server (via `{ server }`) made the dev server hijack all * websocket upgrades - including the app's own connections to the platform * backend - and answer them with the live-reload protocol instead of proxying * them, surfacing as an error in the app. Upgrade routing is handled explicitly * in `registerWebSocketUpgradeHandler`. */ export declare function createWsServer(): import("ws").Server<typeof import("ws").default, typeof import("node:http").IncomingMessage>; /** * Get the proper websocket url, depending on https server options * @param options * @return url */ export declare function getWebsocketUrl(options: ServerOptions): string;