Real-time-Collaboration or Heartbeat API, WebRTC and Web sockets for mere mortals

Earlier this month, Kevin Jahns and a group of contributors came together to learn more about the real-time collaborative efforts for WordPress.

Reliable Sync Protocol PR: Live Demo & Discussion for Collaborative Editing

Kevin Jahns implemented a first version of a reliable sync protocol for collaborative editing in this PR for Gutenberg.

Note: “Collaboration” experiments are already enabled.

Now there are two technical terms that might need explanations: Heartbeat API and WebRTC. And then a third term entered the bar…

Most of the explanations below come from my knowledge gap closer buddy (KGCB), Perplexity.

Heartbeat API

The WordPress Heartbeat API is like a “messenger” that keeps your website and server in sync. It works by sending small, regular updates (called “heartbeats”) between your browser and the server every 15-120 seconds. This allows features like autosaving draftsreal-time notifications, and session management to function smoothly without needing to refresh the page. For example, it can save your work automatically while you write or notify you if someone else is editing the same post.

Documentation: Heartbeat API

WebRTC

WebRTC (Web Real-Time Communication) is a powerful technology that enables direct, real-time communication between web browsers or mobile apps without the need for additional plugins or software. For non-technical website owners, WebRTC can be thought of as a tool that allows your website to offer features like video calls, voice chats, and file sharing directly through the browser.

For real-time collaborative editing, it’s not always reliable. It can help a lot of people, but not all of them.

What are WebSockets and how do they relate to WebRTC?

WebSocket and WebRTC are both technologies that enable real-time communication on the web, but they serve different purposes and have distinct characteristics.

WebSocket is a communication protocol that allows for full-duplex, bidirectional communication between a client (typically a web browser) and a server over a single TCP connection. It provides a persistent connection that remains open, allowing both the client and server to send messages at any time without the need for repeated HTTP requests.

WebRTC (Web Real-Time Communication), on the other hand, is a technology that enables direct peer-to-peer communication between web browsers or applications without the need for intermediary servers. It is primarily designed for high-performance, real-time audio, video, and data transfer.

While both technologies enhance real-time web communication, WebSocket is primarily used for client-server interactions, whereas WebRTC enables direct peer-to-peer communication, particularly for audio and video applications.

In above meeting, there is also a discussion on ways to increase reliability of WebRTC with the help of STUN or TURN servers. I found an article on Medium, trying to explain things. What is WebRTC and How to Setup STUN/TURN Server for WebRTC Communication?


Discover more from I code for a purpose

Subscribe to get the latest posts sent to your email.

I code for a purpose
I code for a purpose
@pauli@icodeforapurpose.com

Personal tech blog of Birgit Pauli-Haack

55 posts
4 followers

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.