Skip to content

Observable cannot cast Expected #324

@TomasGranda

Description

@TomasGranda

Hi, i'm trying to use the Observer this way:

var observable = GetFirebaseClient()
      .Child("rooms")
      .Child(playerID)
      .AsObservable<string[]>()
      .Subscribe(players =>
      {
        Debug.Log(players.Object);
      }, ex =>
      {
        Debug.LogError(ex);
      });

but the observer never runs the first callback.

When i use the observer this way:

var observable = GetFirebaseClient()
      .Child("rooms")
      .Child(playerID)
      .AsObservable<object>()
      .Subscribe(players =>
      {
        Debug.Log(players.Object);
      }, ex =>
      {
        Debug.LogError(ex);
      });

it works and print this:
image

image

As expected. I don't know if this is a bug or i'm using the observer wrong.

Edit:

i fix it using this code:

GetFirebaseClient()
      .Child("rooms")
      .OrderByKey()
      .StartAt(playerID)
      .AsObservable<object>()
      .Subscribe(players =>
      {
        Debug.Log(players.Object);
      },
      ex => Debug.LogError(ex), () => Debug.Log("Completed"));

using OrderByKey and StartAt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions