Skip to main content
MessagePort.prototype.start - worker_threads - Node documentation
method MessagePort.prototype.start

Usage in Deno

import { MessagePort } from "node:worker_threads";
MessagePort.prototype.start(): void

Starts receiving messages on this MessagePort. When using this port as an event emitter, this is called automatically once 'message' listeners are attached.

This method exists for parity with the Web MessagePort API. In Node.js, it is only useful for ignoring messages when no event listener is present. Node.js also diverges in its handling of .onmessage. Setting it automatically calls .start(), but unsetting it lets messages queue up until a new handler is set or the port is discarded.

Return Type

void
Back to top