WebSockets in Nextcloud: creating real‑time apps via AppAPI

Originally published at: WebSockets in Nextcloud: creating real‑time apps via AppAPI - Nextcloud

Nextcloud Hub 25 Autumn adds WebSockets support to the AppAPI ecosystem.

With the new HaRP proxy, External Apps (ExApps) can expose WebSocket endpoints securely through the Nextcloud domain. How does it benefit your apps? The answer is simple: no more polling, lower latency, and cleaner architectures for your real‑time features.

In this article, we explain what WebSockets are, their role in the Nextcloud ecosystem, and how we use them ourselves in Nextcloud Hub apps.

Special thanks to Alexander Piskun, software engineer with Nextcloud’s Integrations Team, for contributing to this article.

What are WebSockets

WebSockets are a communication protocol that enables a persistent, two-way connection between a client and a server via HTTP to exchange updates. The server can then push messages to the browser without repeated one-off HTTP requests. In simple words, WebSockets eliminate the need for the client to constantly ask the server for updates, and instead, they have an ongoing “conversation”. This is ideal for live dashboards, collaborative editors, progress streaming, presence indicators, and chat apps.

How WebSockets work in the Nextcloud ecosystem

Nextcloud’s AppAPI lets you build external apps (ExApps) as microservices in any language, packaged as containers and integrated into the Nextcloud UI. Historically, the built‑in AppAPI proxy didn’t support WebSockets, which made enabling real‑time features difficult or even impossible for ExApps.

With our latest update, Nextcloud Hub 25 Autumn, we introduced HaRP (Nextcloud AppAPI HaProxy Reverse Proxy), recommended for Nextcloud 32+ deployments. HaRP sits behind your main reverse proxy and routes requests directly to ExApps. This includes WebSocket traffic while validating user sessions with Nextcloud. That means WebSockets now work end‑to‑end for ExApps without passing through the PHP stack.

The server reaches ExApps through HaRP, and HaRP can proxy requests from the web UI without going through the Nextcloud server, saving resources, improving performance, and supporting additional protocols like WebSockets.

Lower latency, better interoperability, and a future-proof path

What makes WebSockets great:

  • You have lower latency and fewer moving parts. WebSockets maintain a single, long‑lived connection per client instead of polling endpoints at intervals.
  • Your app can run in any language, since ExApp backends can be Python, Node, Go, whatever your team uses. AppAPI handles lifecycle and integration.
  • It’s a future‑proof path. HaRP is the recommended deploy daemon for AppAPI; the older Docker Socket Proxy workflow is on the path to deprecation, so adopting HaRP readies your app for what is next.

How we use WebSockets in Nextcloud Hub apps

We use WebSockets in our own applications too. For example, in Nextcloud Office (Collabora integration) and optionally in Nextcloud Text if the Nextcloud Files High-Performance Backend is installed. WebSockets help us enable real-time collaboration features in those apps: changes made by one person are propagated immediately to others, and they see the content update in real time.

We also use them in Nextcloud Collectives and Nextcloud Deck, as those are based on Nextcloud Text, to automatically update the content if others make changes. For example, reorder the page list or edit the content on Nextcloud Deck cards. In this case, the real-time features also rely on the Nextcloud Files High-Performance Backend.

Another interesting example is Nextcloud Whiteboard.

Example: WebSockets in Nextcloud Whiteboard app

The Nextcloud Whiteboard WebSocket backend acts as the session controller for each whiteboard. It keeps a roster of sockets per board room, announces when someone joins or leaves, and tracks which client is allowed to act as the active editor so the app efficiently decides who should make changes to the board state.

It simply relays the design payloads that clients send, full scene snapshots, incremental updates, and binary attachments, to everyone else in the room.

For low-latency signals such as cursor trails, viewport following, or presenter cues, it uses a “volatile” lane that favors immediacy over reliability, so the UI stays responsive even if an occasional packet is lost.

The same server endpoint handles collaboration extras like image fetch requests, “follow this user” commands, start and stop of presenting, and the triggers that tell the headless recorder to begin or end a capture.

If you scale out, the service can plug into Redis streams for room fan-out and exposes metrics so operators can watch connection counts and cache health, but otherwise it’s a lean relay dedicated to keeping the live collaboration loop tight.

Other updates for developers in Nextcloud Hub 25 Autumn

Within the Nextcloud ecosystem, you can create apps in any programming language. At your service are our complete API documentation, and a growing library of ready tutorials. Check out AppAPI and External Apps manual to read more about managing ExApps, using AppAPI and HaRP.

Nextcloud Hub 25 Autumn brings more updates for developers of Nextcloud apps, such as:

  • Migration of the Nextcloud ecosystem to the Vue3 framework
  • Mobile framework upgrades
  • Many updates in Nextcloud APIs
  • And more

Read more about all the new features in the Nextcloud Hub 25 Autumn release blog.

More in the Nextcloud Hub 25 Autumn blog series:

Nextcloud Hub 25 Autumn: Your digital workspace, ready in no time

Watch our launch presentation to discover all the new features of Nextcloud Hub 25 Autumn. Wish to experience them first-hand right away? Sign up for an instant trial or get the new version now!

Nextcloud - Get Nextcloud Hub 25 Autumn now!

Get Nextcloud Hub 25 Autumn now!

Start your instant trial right away or download the latest version!