MessagePort
Generated from idl/messaging.webidl when the site was built at 7aa23e2.
MessagePort is an interface in idl/messaging.webidl, inheriting EventTarget, exposed in Window, Worker. What it does is on MDN; this page says what niso has of it.
postMessage (on ports, workers, worker globals, broadcast channels and the window) is the binding’s: it runs StructuredSerializeWithTransfer, where the transferred records are the indices of the ports transferred and transferred ArrayBuffers are serialized as copies and detached, and hands the core the bytes through the internal send operation.
Status
Section titled “Status”The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).
| Feature | On the web | In niso | Members |
|---|---|---|---|
| Channel messaging | Widely available | Partial 88% 340 of 385 subtests pass | 4 |
| messageerror | Widely available | Partial 75% 3 of 4 subtests pass | 1 |
Members
Section titled “Members”send()
Section titled “send()”[NisoInternal] undefined send(ArrayBuffer message, sequence<MessagePort> transfer);int32_t niso_message_port_send(niso_dom* dom, niso_handle self, const uint8_t* message, size_t message_len, const niso_handle* transfer, size_t transfer_len);transferHere()
Section titled “transferHere()”[NisoInternal] static sequence<MessagePort> transferHere(sequence<MessagePort> ports);int32_t niso_message_port_transfer_here(niso_dom* dom, const niso_handle* ports, size_t ports_len, niso_handles* out);structuredClone’s transfer of ports: per port a new MessagePort for the same port, its queue disabled, and the old one detached. Every port is checked before any moves.
start()
Section titled “start()”undefined start();int32_t niso_message_port_start(niso_dom* dom, niso_handle self);close()
Section titled “close()”undefined close();int32_t niso_message_port_close(niso_dom* dom, niso_handle self);onmessage
Section titled “onmessage”attribute EventHandler onmessage;int32_t niso_message_port_get_onmessage(niso_dom* dom, niso_handle self, void** out);int32_t niso_message_port_set_onmessage(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onmessageerror
Section titled “onmessageerror”attribute EventHandler onmessageerror;int32_t niso_message_port_get_onmessageerror(niso_dom* dom, niso_handle self, void** out);int32_t niso_message_port_set_onmessageerror(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onclose
Section titled “onclose”attribute EventHandler onclose;int32_t niso_message_port_get_onclose(niso_dom* dom, niso_handle self, void** out);int32_t niso_message_port_set_onclose(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);Not in niso yet
Section titled “Not in niso yet”Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.
postMessage(Channel messaging)worker_support(Channel messaging)