Skip to main content
Version: 2x

Class: DevServerProxy

Class for spawning new compiler workers for each requested platform and forwarding requests to respective platform-specific DevServer.

The overall architecture is:

`DevServerProxy`
├── <compiler worker platform=ios>
│ └── <webpack compilation>
│ └── `DevServerPlugin`
│ └── `DevServer`
├── <compiler worker platform=android>
│ └── <webpack compilation>
│ └── `DevServerPlugin`
│ └── `DevServer`
└── ...

Each worker is lazy, meaning it will be spawned upon receiving first request from which platform can be inferred. This would usually be a request for bundle eg: index.bundle?platform=ios&....

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DevServerProxy(config, cliOptions)

Constructs new DevServerProxy.

Parameters

NameTypeDescription
configDevServerProxyConfigConfiguration options.
cliOptionsCliOptionsCLI options (usually provided by start command based on arguments from React Native CLI.)

Overrides

BaseDevServer.constructor

Defined in

packages/repack/src/server/DevServerProxy.ts:100

Properties

config

Protected config: BaseDevServerConfig

Configuration options.

Inherited from

BaseDevServer.config

Defined in

packages/repack/src/server/BaseDevServer.ts:35


fastify

fastify: FastifyDevServer

Fastify instance.

Inherited from

BaseDevServer.fastify

Defined in

packages/repack/src/server/BaseDevServer.ts:38


reporter

reporter: Reporter

Reporter instance.

Defined in

packages/repack/src/server/DevServerProxy.ts:88


workers

workers: Record<string, undefined | Promise<CompilerWorker>> = {}

Platform to worker mappings.

Defined in

packages/repack/src/server/DevServerProxy.ts:83


wsClientServer

wsClientServer: WebSocketDevClientServer

Server instance for React Native clients.

Inherited from

BaseDevServer.wsClientServer

Defined in

packages/repack/src/server/BaseDevServer.ts:48


wsDashboardServer

wsDashboardServer: WebSocketDashboardServer

Defined in

packages/repack/src/server/DevServerProxy.ts:84


wsDebuggerServer

wsDebuggerServer: WebSocketDebuggerServer

Debugger server instance.

Inherited from

BaseDevServer.wsDebuggerServer

Defined in

packages/repack/src/server/BaseDevServer.ts:42


wsEventsServer

wsEventsServer: WebSocketEventsServer

Events server instance.

Inherited from

BaseDevServer.wsEventsServer

Defined in

packages/repack/src/server/BaseDevServer.ts:46


wsMessageServer

wsMessageServer: WebSocketMessageServer

Message server instance.

Inherited from

BaseDevServer.wsMessageServer

Defined in

packages/repack/src/server/BaseDevServer.ts:44


wsRouter

wsRouter: WebSocketRouter

WebSocket router instance.

Inherited from

BaseDevServer.wsRouter

Defined in

packages/repack/src/server/BaseDevServer.ts:40

Methods

forwardRequest

forwardRequest(platform, request, reply, multipartRes?): Promise<void>

Forward request to a DevServer running inside compiler worker for the platform.

Parameters

NameTypeDescription
platformstringApplication platform.
requestDevServerRequestRequest instance to forward.
replyDevServerReplyReply instance to send received data through.
multipartRes?MultipartResponse-

Returns

Promise<void>

Defined in

packages/repack/src/server/DevServerProxy.ts:217


run

run(): Promise<void>

Runs the proxy.

Returns

Promise<void>

Overrides

BaseDevServer.run

Defined in

packages/repack/src/server/DevServerProxy.ts:406


runWorker

runWorker(platform): Promise<void>

Spawn new compiler worker for given platform. If the worker is already running, a warning is emitted and the method stops it's execution. The port on which DevServer inside worker will be running is random, so no assumptions should be taken regarding the port number.

Parameters

NameTypeDescription
platformstringApplication platform for which to spawn new worker.

Returns

Promise<void>

Defined in

packages/repack/src/server/DevServerProxy.ts:115


setup

setup(): Promise<void>

Sets up routes.

Returns

Promise<void>

Overrides

BaseDevServer.setup

Defined in

packages/repack/src/server/DevServerProxy.ts:281