jhagas / ESPSupabase

Connect ESP32/8266 with Supabase. Enhance your IoT project with open-source database service
MIT License
43 stars 15 forks source link

realtime-postgresChanges does not work. #23

Open GuneshRaj opened 4 days ago

GuneshRaj commented 4 days ago

Hi, I cant seem to get the realtime updates working. Im using Ardiono with ESp32 with v3 SDK.

I matted to connect to Supabase and handle DB transactions - works fine. However, the Real Time Table updates / Record updates does not trigger any events.

The code is exactly as your example with a different Table. The Table also us visible via the Anna Login and has Real time enabled with no RLS. The Table has been tested with realtime over the Web ad it works - so the config seems fine.

In the Loop run, it only prints this:

[WSc] Disconnected!

Appreciate any help here. Thanks

The Code

Sample Code:


// Some header codes and handlers

void HandleChanges(String result) {
    Serial.println(result);

  JsonDocument doc;
  deserializeJson(doc, result);

  // Example of what you can do with the result
  String tableName = doc["table"];
  String event = doc["type"];
  String changes = doc["record"];

  Serial.print(tableName);
  Serial.print(" : ");
  Serial.println(event);
  Serial.println(changes);
}

void setup() {
 // some code ...
  realtime.addChangesListener("mytable1", "UPDATE", "public", "id=eq.3");
  realtime.addChangesListener("mytable2", "*", "public", "");
  realtime.listen();
}

void loop() {
  realtime.loop();
}
tecno-smart commented 1 day ago

same issue with me