Web Messaging is the way for documents to separates browsing context to share the data without Dom. It overrides the cross-domain communication problem in different domains, protocols or ports.
For example, you want to send the data from your page to ad container, which is placed at iframe, or voice-versa, in this scenario, Browser throws a security exception. With web messaging, we can pass the data across as a message event.
Message events fires Cross-document messaging, channel messaging, server-sent events and web sockets.