Firebase Schema

Firebase and Firestream schema

Chat SDK v5 - Example Firebase JSON

This JSON shows a typical Firebase database schema with one chat thread with one message. Two users, one of which has the other user as a contact and also blocked.

{
  "threads" : {
    "-MBtATOUMrdVcf00dKM8" : {
      "details" : {
        "creation-date" : 1594392177181,
        "creator" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
        "creator-entity-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
        "name" : "",
        "type" : 2,
        "type_v4" : 2
      },
      "messages" : {
        "-MBtAUWXGAfptOca757W" : {
          ".priority" : 1594392181233,
          "date" : 1594392181233,
          "from" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
          "meta" : {
            "text" : "Hi"
          },
          "read" : {
            "9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
              "date" : 1594392181743,
              "status" : 1
            },
            "NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
              "status" : 2
            }
          },
          "to" : [ "9tJUx1iT5LQ1bC1J952No6sNZjZ2" ],
          "type" : 0,
          "user-firebase-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
        }
      },
      "meta" : {
        "creation-date" : 1594392176550,
        "creator" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
        "creator-entity-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
        "name" : "",
        "type" : 2,
        "type_v4" : 2
      },
      "users" : {
        "9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
          "status" : "member"
        },
        "NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
          "status" : "owner"
        }
      }
    }
  },
  "users" : {
    "9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
      "last-online" : 1594392150028,
      "meta" : {
        "availability" : "available",
        "email" : "2@d.co",
        "name" : "Andy",
        "name-lowercase" : "andy",
        "pictureURL" : "http://identicon.sdk.chat?value=9tJUx1iT5LQ1bC1J952No6sNZjZ2&size=400.png"
      },
      "online" : true,
      "threads" : {
        "-MBtATOUMrdVcf00dKM8" : {
          "invitedBy" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
        }
      }
    },
    "NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
      "blocked" : {
        "9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
          "uid" : "9tJUx1iT5LQ1bC1J952No6sNZjZ2"
        }
      },
      "contacts" : {
        "9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
          "type" : 0
        }
      },
      "last-online" : 1594391749332,
      "meta" : {
        "availability" : "available",
        "email" : "1@d.co",
        "name" : "Ben",
        "name-lowercase" : "ben",
        "pictureURL" : "http://identicon.sdk.chat?value=NX6mGPCkR3NcNiJJxBzNrsR2Anz2&size=400.png"
      },
      "online" : true,
      "threads" : {
        "-MBtATOUMrdVcf00dKM8" : {
          "invitedBy" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
        }
      }
    }
  }
}

Firestream Example JSON

Last updated

Was this helpful?