Cloud Firestore-两个玩家-检测断开连接[颤振]

时间:2019-03-16 18:22:39

标签: socket.io dart flutter google-cloud-firestore

INSERT INTO store (name, producent, model, number, 
   quantity, warehouse, location) 
   VALUES(%s, %s, %s, %s, %s, %s, %s)
   ON DUPLICATE KEY UPDATE quanity=quantity+VALUES(quantity)

我正在使用颤动制作两个玩家的非图形游戏。 Firestore既简单又可扩展。所以我决定使用它。

我如何检测其中一位用户的断开连接?

Firestore.instance.runTransaction((Transaction tx) async {
    DocumentSnapshot roomSnapshot = await tx.get(_docRef);
    if (roomSnapshot.exists) {
      await tx.update(_docRef, {
        'isAvailable': false, //change room status to unavailable.
      });

在这里,我正在房间里听音乐并传送分数。

或者我应该在这种用例中使用sockets.io的dart插件吗?

0 个答案:

没有答案
相关问题