Web messaging allows sending real-time messages between a server and client browser by overriding cross-domain communication restrictions. It uses message events to pass data across domains via postMessage(). Message channels create two message ports to allow two-way communication between browsing contexts like iframes. Data can be sent and received across documents by listening for message events and transferring message ports between frames.