Skip to content

Can't retrieve data through RealtimeChannel.OnUpdate #22

@Shenrak

Description

@Shenrak

Bug report

Describe the bug

RealtimeChannel's response isn't parsed correctly.
Both RealtimeChannel.Model<T>() and PostgresChangesEventArgs.Response.Payload.Data.Record.Record are defaults values.

To Reproduce

Subscribe to a table with RealtimeChannel.OnUpdate

Expected behavior

Getting correct data that's been updated

Screenshots

Table maintenance
image

    [Table("maintenance")]
    public class SchemaMaintenance : BaseModel
    {
        [PrimaryKey("forced_version", false)] public string ForcedVersion { get; set; }
        [Column("is_on_maintenance")] public bool IsOnMaintenance { get; set; }
    }
    public static void StartConnectedDeviceWatcher()
    {
        var channel = SupabaseManager.app.Realtime.Channel("realtime", "public", "maintenance");

        channel.OnUpdate += (object sender, PostgresChangesEventArgs a) =>
        {
            var m = a.Response.Model<SchemaMaintenance>();
            Console.WriteLine("Item updated: " + a.Response.Payload.Data.Record.Record);
        };
        channel.Subscribe().ContinueWith(HandleErrors);
    }

The following screenshot showcases what's happening in RealtimeChannel.Model()
image

The raw content of Json :
image

System information

  • OS: Windows (Unity)

Additional context

I'd like to add that it was not clear to me as what to put in databasefield of Channel() :
image
As my table was in the postgres database, i had a though time to figure it out :p

Guillaume

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions