Exception when using Firebase streaming

Yusuf-3141 50 Reputation points
2024-10-18T05:54:17.3033333+00:00

Hi,
When I try to read data from Firebase using FirebaseDatabase.net Library I receive Newtonsoft.Json.JsonReaderException exeptionn

this code works


Imports Firebase.Database
Imports Firebase.Database.Query
Public Class Form1
    Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim client As New FirebaseClient("https://abcd.asia-southeast1.firebasedatabase.app/")
        Dim gesture = Await client _
            .Child("gestures") _
            .Child("last_gesture") _
            .OnceSingleAsync(Of String)()
        If gesture IsNot Nothing Then
            Label1.Text = gesture
        Else
            Label1.Text = "..."
        End If
        Console.WriteLine(gesture)
    End Sub
End Class


but this code does not work when using streaming

Imports Firebase.Database
Imports Firebase.Database.Query
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim client As New FirebaseClient("https://abcd.asia-southeast1.firebasedatabase.app/")
        client.Child("gestures").Child("last_gesture").AsObservable(Of String)() _
        .Subscribe(Sub(f)
                       Console.WriteLine(f.Object)
                       If f.Object IsNot Nothing Then
                           Label1.Invoke(Sub() Label1.Text = f.Object)
                       End If
                   End Sub)
    End Sub
End Class


How can I solve this issue
Thank you in advance

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,914 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,760 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Yusuf-3141 50 Reputation points
    2024-10-20T23:35:24.6+00:00

    I think the issue not in firebase itself because i can read / write to it without problem the issue only hapen when try receive data using streaming i have reach this advanced stage of project and here is the project on Github
    https://github.com/devenv2/WinFormsApp1/tree/master

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.