import '../WorkerInit.js';
import { EchoDefinition } from '@devvit/protos/types/devvit/runtime/actor/echo.js';
import { EchoActor } from '../../common/actors/EchoActor.js';
import { WorkerDispatcher } from '../../common/envelope/dispatcher/WorkerDispatcher.js';
import { EnvelopeServerBuilder } from '../../common/envelope/EnvelopeServerBuilder.js';
import { Log } from '../../lib/loggers/Log.js';
// self.name is the full hostname
const dispatcher = new WorkerDispatcher(self.name);
dispatcher.bindToWorkerPort(self);
const actor = new EchoActor();
const server = EnvelopeServerBuilder.build(self.name, [EchoDefinition], actor);
dispatcher.bind(server);
Log.verbose(`${self.name} ready.`);
