@litert/televoke
Version:
A simple RPC service framework.
42 lines • 1.52 kB
TypeScript
/**
* Copyright 2025 Angus.Fenying <fenying@litert.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as NodeWorker from 'node:worker_threads';
import type * as dT from '../Transporter.decl';
export interface IMainThreadGateway extends dT.IGateway {
/**
* Add a worker thread to the gateway, so that the gateway can communicate with it.
*
* > The worker thread must be online already.
*
* @param worker The worker instance on the main thread.
*/
registerWorker(worker: NodeWorker.Worker): void;
}
/**
* Create a gateway that runs in the main thread.
*
* @param server The server instance.
* @experimental
*/
export declare function createMainThreadGateway(server: dT.IServer): IMainThreadGateway;
/**
* Create a gateway that runs in the worker thread.
*
* @param server The server instance.
* @experimental
*/
export declare function createWorkerThreadGateway(server: dT.IServer): dT.IGateway;
//# sourceMappingURL=WorkerThread.Server.d.ts.map