Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[node:worker_threads] The behavior of MessagePort.on() differs between Deno and Node.js #23561

Closed
mys1024 opened this issue Apr 25, 2024 · 0 comments · Fixed by #23600
Closed
Assignees
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat

Comments

@mys1024
Copy link

mys1024 commented Apr 25, 2024

Version: Deno 1.42.4, Node.js 20.11.1

The behavior of MessagePort.on() differs between Deno and Node.js with the following code:

import { MessageChannel } from "node:worker_threads";

const { port1, port2 } = new MessageChannel();

port1.on("message", (msg) => console.log("listener1", msg));
port1.on("message", (msg) => console.log("listener2", msg));

port2.postMessage("hi!");

In Node.js, it prints:

listener1 hi!
listener2 hi!

In Deno, however, it only prints:

listener2 hi!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node API polyfill Related to various "node:*" modules APIs node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants