Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Realtime subscription takes few seconds to recognize changes after successful subscription

オープン
#322 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp

調査の方向性

再現手順で Channel、Subscribe()、PostgresChangesOptions、AddPostgresChangeHandler を使用する Realtime チャネルのフローから開始します。説明されている Unity/IL2CPP セットアップを使用し、サブスクリプションの成功した確認応答と、データベースの変更がハンドラーに届き始めるタイミングを比較します。購読したテーブルが報告されている数秒の遅延なしに変更を受信し、既存のテスト箇所が見つかった場合は回帰テストのカバレッジも追加されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area: realtime bug

Description

After successfully subscribing to a Realtime channel with channel.Subscribe(), there is approximately a 4-second delay before the subscription actually starts recognizing changes to the subscribed table. This occurs even though the subscription appears to be successful immediately (indicated by successful subscription log messages).

Environment

  • Unity Version: 2022.3.35f1
  • Supabase.Realtime Version: 6.0.4
  • Operating System: Windows
  • Project Type: Unity C# (IL2CPP)

Reproduction Steps

  1. Initialize Supabase Realtime client and ensure socket connection
  2. Subscribe to a table using the following pattern:
//Method-Setup
 public async Task<string> SubscribeToTable(string tableName, string filter, string columnName, bool isCustomer, Action<string> onValueChanged)
 {
     try
     {
         var channel = client.Realtime.Channel($"public:{tableName}");        

         var subscriptionInfo = new SubscriptionInfo
         {
             TableName = tableName,
             ColumnName = columnName,
             Filter = filter,
             Channel = channel
         };

         subscriptionInfo.OnValueChanged += onValueChanged;

         try
         {
             channel.Register(new PostgresChangesOptions(
                 schema: "public",
                 table: tableName,
                 eventType: PostgresChangesOptions.ListenType.All,
                 filter: filter
             ));

             channel.AddPostgresChangeHandler (PostgresChangesOptions.ListenType.All, (sender, response) =>
             {
                 try
                 {
                     if (response?.Payload?.Data?.Record != null)
                     {
                         var recordDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(
                             JsonConvert.SerializeObject(response.Payload.Data.Record)
                         );

                         if (recordDict.TryGetValue(columnName, out object columnValueObj) && columnValueObj != null)
                         {
                             string value = columnValueObj.ToString();
                             Debug.Log($"Column value changed to: {value}");
                             subscriptionInfo.InvokeValueChanged(value);
                         }
                     }
                     else
                     {
                         Debug.Log("Changed payload record resulted in null");
                     }
                 }
                 catch (Exception ex)
                 {
                     Debug.LogError($"Error in change handler: {ex.Message}");
                 }
             });

             await channel.Subscribe();

             activeSubscriptions[subscriptionId] = subscriptionInfo;

             Debug.Log($"Successfully subscribed to {tableName}");
             return subscriptionId;
         }
         catch (Exception ex)
         {
             Debug.LogError($"Error setting up channel: {ex.Message}");
             return null;
         }
     }
     catch (Exception e)
     {
         Debug.LogError($"Subscription setup failed: {e.Message}");
         Debug.LogError($"Stack trace: {e.StackTrace}");
         return null;
     }
 }
 
 //Usage:
    string loginTokenSub = await supabaseManager.SubscribeToTable(
       "login_tokens",
       $"token=eq.{CurrentToken}",
       "status",
       false,
       (newValue) => {
           Debug.Log($"login_tokens value changed to: {newValue}");
       }
   );

// Subscription appears successful here
Debug.Log("Successfully subscribed to login_tokens");

// If a change is made to the table immediately, it won't be recognized
// Need to wait ~4 seconds before changes are detected
主要言語
C#
スター
704
フォーク
111
平均マージ
1日 14時間
マージ済み PR(30日)
82

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

supabase/supabase-csharp のほかの issue

supabase/supabase-csharp の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。