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.
1
{
2
"threads" : {
3
"-MBtATOUMrdVcf00dKM8" : {
4
"details" : {
5
"creation-date" : 1594392177181,
6
"creator" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
7
"creator-entity-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
8
"name" : "",
9
"type" : 2,
10
"type_v4" : 2
11
},
12
"messages" : {
13
"-MBtAUWXGAfptOca757W" : {
14
".priority" : 1594392181233,
15
"date" : 1594392181233,
16
"from" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
17
"meta" : {
18
"text" : "Hi"
19
},
20
"read" : {
21
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
22
"date" : 1594392181743,
23
"status" : 1
24
},
25
"NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
26
"status" : 2
27
}
28
},
29
"to" : [ "9tJUx1iT5LQ1bC1J952No6sNZjZ2" ],
30
"type" : 0,
31
"user-firebase-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
32
}
33
},
34
"meta" : {
35
"creation-date" : 1594392176550,
36
"creator" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
37
"creator-entity-id" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2",
38
"name" : "",
39
"type" : 2,
40
"type_v4" : 2
41
},
42
"users" : {
43
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
44
"status" : "member"
45
},
46
"NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
47
"status" : "owner"
48
}
49
}
50
}
51
},
52
"users" : {
53
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
54
"last-online" : 1594392150028,
55
"meta" : {
56
"availability" : "available",
57
"email" : "[email protected]",
58
"name" : "Andy",
59
"name-lowercase" : "andy",
60
"pictureURL" : "http://identicon.sdk.chat?value=9tJUx1iT5LQ1bC1J952No6sNZjZ2&size=400.png"
61
},
62
"online" : true,
63
"threads" : {
64
"-MBtATOUMrdVcf00dKM8" : {
65
"invitedBy" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
66
}
67
}
68
},
69
"NX6mGPCkR3NcNiJJxBzNrsR2Anz2" : {
70
"blocked" : {
71
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
72
"uid" : "9tJUx1iT5LQ1bC1J952No6sNZjZ2"
73
}
74
},
75
"contacts" : {
76
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
77
"type" : 0
78
}
79
},
80
"last-online" : 1594391749332,
81
"meta" : {
82
"availability" : "available",
83
"email" : "[email protected]",
84
"name" : "Ben",
85
"name-lowercase" : "ben",
86
"pictureURL" : "http://identicon.sdk.chat?value=NX6mGPCkR3NcNiJJxBzNrsR2Anz2&size=400.png"
87
},
88
"online" : true,
89
"threads" : {
90
"-MBtATOUMrdVcf00dKM8" : {
91
"invitedBy" : "NX6mGPCkR3NcNiJJxBzNrsR2Anz2"
92
}
93
}
94
}
95
}
96
}
Copied!

Firestream Example JSON

1
{
2
"chats" : {
3
"-MCw525wN7BBuycJ5UX0" : {
4
"messages" : {
5
"-MCw53dwaUZqimC0b-yC" : {
6
".priority" : 1595514833932,
7
"body" : {
8
"text" : "0",
9
"type" : ""
10
},
11
"date" : 1595514833932,
12
"from" : "liedgpMs2thMhkZjphkc3dH5VcV2",
13
"type" : "message"
14
}
15
},
16
"meta" : {
17
"created" : 1595514827588,
18
"data" : {
19
"Key2" : 999,
20
"TestKey" : "TestValue"
21
},
22
"image-url" : "https://chatsdk.co/wp-content/uploads/2017/01/image_message-407x389.jpg",
23
"name" : "Test"
24
},
25
"users" : {
26
"6TB34PbMqdU67KHvIuGrekMCIOk2" : {
27
"role" : "banned"
28
},
29
"9tJUx1iT5LQ1bC1J952No6sNZjZ2" : {
30
"role" : "admin"
31
},
32
"liedgpMs2thMhkZjphkc3dH5VcV2" : {
33
"role" : "owner"
34
}
35
}
36
}
37
},
38
"users" : {
39
"6TB34PbMqdU67KHvIuGrekMCIOk2" : {
40
"messages" : {
41
"-MCw52Fu3NEUszVjFYfn" : {
42
".priority" : 1595514828219,
43
"body" : {
44
"id" : "-MCw525wN7BBuycJ5UX0",
45
"type" : "chat"
46
},
47
"date" : 1595514828219,
48
"from" : "liedgpMs2thMhkZjphkc3dH5VcV2",
49
"type" : "invitation"
50
}
51
}
52
},
53
"liedgpMs2thMhkZjphkc3dH5VcV2" : {
54
"chats" : {
55
"-MCw525wN7BBuycJ5UX0" : {
56
"date" : 1595514828551
57
}
58
}
59
}
60
}
61
}
Copied!
Last modified 7mo ago