Developer

Real-time communication made easy: a guide to webhooks and WebSockets

How you can leverage webhooks and WebSockets to build applications and integrations that use Zoom’s video-based communications solutions.
4 min read

Updated on January 26, 2023

Published on January 25, 2023

WebSockets and webhooks

Webhooks and WebSockets are two highly effective protocols that have transformed the way we think about real-time communication and data transfer on the web. At Zoom, we recently launched WebSockets in beta to give you even more tools to create innovative and engaging experiences for users worldwide. Here, we’ll explain how you can leverage webhooks and WebSockets to build applications and integrations that use Zoom’s video-based communications solutions or integrate core Zoom technology.

What are webhooks and WebSockets?

Webhooks and WebSockets are key components of modern applications, as they provide crucial event notification services. Both webhooks and WebSockets allow you to receive notifications about events in your Zoom account in real time. They also support applications that need to respond to changes or updates as soon as they happen. However, there are some key differences between webhooks and WebSockets that you should consider when deciding which one is the right fit for your use case, such as ease of implementation, speed of delivery, reliability, architecture, and other factors.

Comparing webhooks and WebSockets

Protocols and ease of implementation

Webhooks use the HTTP protocol, while WebSockets use the WebSocket protocol (ws or wss). Because of this, webhooks are generally easier to implement, as they only require an endpoint URL to receive HTTP POST requests. WebSockets require a more complex setup, including obtaining an access token and opening a connection to the server.

Speed of delivery

WebSockets are generally faster in terms of delivery than webhooks because they offer a duplex communication channel. WebSockets allow for a single connection to be established between the client and server, enabling the exchange of data in real time without the need for additional HTTP requests. Compared to webhooks, a persistent connection can result in faster delivery of event notifications and more efficient use of resources.

Reliability

When evaluating options for event-based communication, reliability is critical. Webhooks send a notification to a specific URL when an event occurs. However, if the endpoint is experiencing problems, the event notification may not be processed correctly. WebSockets, alternatively, maintain a persistent connection with the server, allowing for more consistent and reliable communication.

Architecture

Webhooks are based on a "push" model, where Zoom pushes event notifications to endpoints as they occur. WebSockets are based on a "pull" model, where the client establishes a connection with the server and then receives event notifications as they occur. 

Stateless vs. stateful

Webhooks are stateless, meaning that each event notification is independent and carries all the necessary information about the event. WebSockets are stateful, meaning that the client and server maintain a persistent connection and can share state information throughout the lifetime of the connection.

Use cases

Webhooks may be a better solution when an app only needs to receive a small number of event notifications. Let’s say you have a marketplace app that needs to receive a notification when a user creates, updates, or deletes a meeting. In this case, webhooks work well because the app only needs to receive a small number of event notifications (i.e., a notification on meeting-related events). Setting up a simple endpoint to receive these notifications via webhooks is more efficient than implementing WebSockets.

WebSockets can be a good option for those developing applications in industries like banking, finance, and healthcare. When implementing webhooks, a developer needs to make extra efforts to secure their endpoint, like validating the request and whitelisting the IPs. On the other hand, WebSockets come with an additional layer of security as the connection is established directly between the client and the server, which reduces the risk of man-in-the-middle attacks. WebSockets provide a more reliable connection, as data is transferred only when the connection is opened, and it remains open until closed by the developer. One more interesting fact about Zoom WebSockets is that the connection can only be opened by the access token generated from the app that created the WebSocket subscription, and only one connection can be kept open at a time. One of the main advantages of WebSockets over webhooks is that they allow for real-time, low-latency communication, which is essential for use cases where real-time updates are critical. 

Essential tools for engaging experiences

WebSockets and webhooks are essential tools for building interactive applications on the web because they provide seamless and efficient updates, low latency, cost-efficiency, and scalability. At Zoom, we utilize these technologies to create engaging and intuitive user experiences. Whether you are building a customer engagement app or a monitoring system, these event notifiers are vital to unlocking your app's full potential. 

To help you get started, we’ve created documentation for both webhooks and WebSockets (beta). Enroll in the WebSockets Beta by completing this form for early access to this new feature.

Our customers love us

Okta
Nasdaq
Rakuten
Logitech
Western Union
Autodesk
Dropbox
Okta
Nasdaq
Rakuten
Logitech
Western Union
Autodesk
Dropbox

Zoom - One Platform to Connect