Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于web的Firebase云消息传递_Firebase_Google Cloud Messaging_Messaging_Firebase Realtime Database_Firebase Cloud Messaging - Fatal编程技术网

用于web的Firebase云消息传递

用于web的Firebase云消息传递,firebase,google-cloud-messaging,messaging,firebase-realtime-database,firebase-cloud-messaging,Firebase,Google Cloud Messaging,Messaging,Firebase Realtime Database,Firebase Cloud Messaging,我想用Google的Firebase为web构建一个消息传递应用程序。在此应用程序中,用户应向其他用户发送和接收消息。我查看了谷歌的Firebase网站,但我迷路了。你能告诉我从哪里开始吗?你能给我看一些关于Firebase web消息传递的教程或类似的东西吗?我欢迎任何建议。谢谢。FCM(firebase云消息)只能通过Android、iOS和web(指定的Google Chrome)实现。因此,为了在所有浏览器的web应用程序上使用它,我们必须实现firebase数据库。您可以看到这一点您还

我想用Google的Firebase为web构建一个消息传递应用程序。在此应用程序中,用户应向其他用户发送和接收消息。我查看了谷歌的Firebase网站,但我迷路了。你能告诉我从哪里开始吗?你能给我看一些关于Firebase web消息传递的教程或类似的东西吗?我欢迎任何建议。谢谢。

FCM(firebase云消息)只能通过Android、iOS和web(指定的Google Chrome)实现。因此,为了在所有浏览器的web应用程序上使用它,我们必须实现firebase数据库。您可以看到这一点

您还可以将Firebase Cloud Messaging for web与Jquery一起使用,如:

 $("#button").click(function(){

   var json = {
     "to": "dBbB2BFT-VY:APA91bHrvgfXbZa-K5eg9vVdUkIsHbMCwHRVc8dBAvoH_3ZxxxxxVVeMXP7Bm0iera5s37ChHmAVh29P8aAVa8HF0I0goZKPYdGT6lNl4MXN0na7xbmvF25c4ZLl0JkCDm_saXb51Vrte",
     "notification": {
       "title": "Push enviado com JQuery",
       "body": "Corpo de mensagem web!"
     },
     "data": {
       "titulo": "Título da mensagem de dados!",
       "descricao": "Corpo dos dados..."
     }
   };

   $.ajax({
    url: 'https://fcm.googleapis.com/fcm/send',
    type: "POST",
    processData : false,
    beforeSend: function (xhr) {
      xhr.setRequestHeader('Content-Type', 'application/json');
      xhr.setRequestHeader('Authorization', 'key=AIzaSyBShxxxxXevRq0trDbA9mhnY_2jqMoeChA');
    },
    data: JSON.stringify(json),
    success: function () {
      console.log("Mensagem enviada com sucesso!");
    },
    error: function(error) {
      console.log(error);
    }
  });
});

Firebase Cloud Messaging for Web现在适用于许多浏览器

我们已经写了一篇文章。

你可以在这里看到:
(我使用了身份验证来登录用户,并使用实时数据库来获取和发送消息到数据库。它还可以实时更新)

@Qualwebs我们是否可以使用谷歌的推送通知来与firebase一起使用chrome网站。web的google云消息推送通知与google firebase推送通知之间的主要区别是什么。我们想使用google推送通知和firebase为网站发送推送通知,这可能吗?你可以从这里开始:FCM支持Chrome:50+Firefox:44+Opera Mobile:37+嗨,我在Android上做了一个web应用程序,Chrome,我能够获得通知。是否可以对Safari、iOS使用相同的实现?还是需要修改代码?你很困惑。“Firebase数据库”与此无关。根据Firebase文档,“由于服务器密钥的敏感性,永远不要从客户端发送此类请求。”我可以在Netscape Navigator中也使用这种方法吗?