Skip to content
Back

Realtime API over cloudflare tunnels

  • 0
  • Self Hosted
  • Realtime
MrT
18 Feb, 2026, 19:15

Hello. Is it possible to use the realtime subscriptions, when the self-hosted instance is exposed via cloudflare tunnels? There is no additional proxy. I am using latest SDK for next.js and when i try to subscribe to a particular table:

TypeScript
const subString = Channel.tablesdb("<db_id>").table("<table_id>");
const sub = realtime.subscribe(subString, response => {
    console.log(response.payload);
});

seems like it does not receive any updates. The state, when logged to console, is 'pending', and no operations in that table can trigger the sub. I tried setting the

TypeScript
.setEndpointRealtime("wss://myappwriteinstance.com/v1/realtime")

but this did not work either.

TL;DR
Developers experiencing issues with realtime API subscriptions through Appwrite when self-hosted over Cloudflare tunnels. Legacy subscriptions work, but newer ones don't. Attempts to resolve by awaiting the subscribe() function and changing the setEndpointRealtime() parameter have been unsuccessful. Potential solution may involve troubleshooting the Cloudflare tunnel setup or examining the way Appwrite is hosted through Coolify.
MrT
18 Feb, 2026, 19:18

actually i spotted that I did not await the subscribe() but even with that done - still no results

Roelj44
18 Feb, 2026, 19:53

Same issue here.

Below a react component I created to test the realtime connection. What I found is that only the old way of writing subscriptions works (see attached image which show the logs i receive). The legacy subscription does come through. When i test this same setup, but then with an Appwrite cloud client, it does work. So I assume it has something to do with the self-hosting or setup of it. The current way I host Appwrite is though Coolify, in which I started with the default template, and upgraded from 1.7.4. > 1.7.5 > 1.8.0 > 1.8.1. On each updagrade did a migration if necessary, but still no luck.

Would be great if someone could help!

TypeScript
"use client";

import { useEffect } from "react";
import { Channel } from "appwrite";
import { Client, Realtime } from "appwrite";

export function RealtimeTest() {
  useEffect(() => {
    const client = new Client()
      .setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!)
      .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID!);

    const realtime = new Realtime(client);

    client.subscribe("rows", (response) => {
      console.log("Legacy row event:", response);
    });

    const startSubscription = async () => {
      try {
        console.log("Subscribing to realtime events...");

        const subscription = await realtime.subscribe(
          Channel.rows(),
          (response) => {
            console.log("New async Realtime event:", response);
          },
        );

        console.log("Subscription created: ", subscription);
      } catch (err) {
        console.error("Realtime subscribe failed:", err);
      }
    };

    startSubscription();
  }, []);
  return <></>;
}
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more