empty data created in firebase realtime database [on hold]

By | October 30, 2018
Questions:

I’m developing chat application using firebase realtime database.
From months ago, I was using firebase normally. However some days ago, abnormal result occurred like below. When I set my data in database.
Correct data set normally, but empty data also set.

enter image description here

Sorry for not including my code.

my code is like below. I’m using flask.

chatrooms_ref = firebase_admin.db.reference("/chat_rooms")
ex_chatrooms_ref = firebase_admin.db.reference("/ex_chat_rooms")
approachingUsers_ref = firebase_admin.db.reference('/approaching_users')
members_ref = firebase_admin.db.reference('/chat_members')
msg_ref = firebase_admin.db.reference('/chat_messages')

(not related codes omitted)

def createChat(chatId, user, partner):

#todo 채팅 멤버에 자신 추가
chat_data = dict()
last_message = dict()
gen_key = chatrooms_ref.push()
last_message['messageId'] = gen_key.key
last_message['uid'] = user.firebase_uid
last_message['unreadCount'] = 0
last_message['messageDate'] = time.time()
last_message['messageType'] = "TEXT"
last_message['messageText'] = ""

chat_data['chatroom_id'] = chatId
chat_data['partner_id'] = partner.id
chat_data['partner_firebase_uid'] = partner.firebase_uid
chat_data['created_date'] = time.time()
chat_data['disabled'] = False
chat_data['last_message'] = last_message
chat_data['nickname'] = partner.nick
chat_data['photoUri'] = partner.profile_image_url
chat_data['totalUnreadCount'] = 0

# 다가온 유저 추가
appUser_data = dict()

appUser_data['nickname'] = user.nick
appUser_data['user_id'] = user.id
appUser_data['photoUri'] = user.profile_image_url

#chat_members 추가
members_data = dict()
members_data['user_uid'] = user.firebase_uid
print("why?")
approachingUsers_ref.child(partner.firebase_uid).child(user.firebase_uid).set(appUser_data)
chatrooms_ref.child(user.firebase_uid).child(chatId).set(chat_data)
members_ref.child(chatId).set(members_data)
Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *