FCM主题最大有效载荷大小



我在系统中集成了firebase消息传递,我正在遇到麻烦。

文档说:

通知消息是更轻巧的选项,带有2kb 限制和预定义的用户可见密钥。数据消息让 开发人员发送多达4KB的自定义键值对。通知 消息可以包含可选的数据有效载荷 用户点击通知。

,但我无法以任何方式管理数据消息中的4KB数据。这是我的curl命令

curl -XPOST -H 'Authorization: key=my_server_key' -H "Content-type: application/json" -d '{
    "to": "/topics/my_test_topic",
    "data": {
        "k" : "bdbe6af06a70f2769e3051de4855612938b7455393fa6f4e08b87635a944250607f4fbdd0dee1900ca1351ffc70ecd287cf41c7a0416361ec8e7001bc8bbd1aa908d3331f5128fc721f58d51be5400656534a01758ccc249d78636de7ea0eedba2a0081b52de36968654cb8a8cc32e3524460ad841ff9b1b9b442c5b8add2dfd3423112ba570483ead04027a4e7cb3a15a5732bc150c4186170e9845b1199d08a0380268e94b920112ec98d757d0e6bce8be3dd571e61cc5ca9dd7d0214e5272423d918debb590929a0598048e9741363ee999b0939d32ab6c9800e227b1239c4193d98bf3776b87656cc814ec706fe6b63cd608187e4ed3888a87939f791cc2f699ae09cd582f42b6c0ebeeae964082ed0efabcfb25c24bc25f2357849529158c718c6d7710b0011374c4da648808462f85161cf14c3448e46b393a1f496d752aa4b462a6f0769d3acbfe23581156df722ada2eda0ae2da600c4d1990a6c46e748d8f9bcf42d36f47bac67c00988e0b0b897a01dbe67184d714efbd464be0ddee64dd68e155cfd28fa3e01be428d407632521acf73789907f4e45723ce22ad9ab68b7d3bd49f1dad2d73ae749131dc83722ce84e66aa53d115a0dbea00e0490fc555ddd79ecffc32f9a9a786b0f590a332f1828f8ecd830689cf778e1529e3d8724e4d7a5d8baa3e151bfe51aea15f69615ad3a85d05199b4401370f6af778159ed6c953036b500a202e61eb5637455aa19703dea4f9a5bb4cee795901037d0dab3f02c46d28b2da4e409c16896ae2f0512cfa11e1c997d3b0ed3f04a956b2d2af9e95b86fb46f600ea5a807ace3d887f58b65820bebb861e4139289bd72a99ee8141e58895357c86f481f343659965c84d1fa9533edc038e569d6a6ca09ed3a0b2fbc5097aee22ac4428acec1373744f6867cfbbcf2a17ecceba9fc72d0fc39e5fafe960de0aa069bf6f78308e9e4067b381a454e2032bc0744d504a52010bed05418485bb72453a27751cc7c0f7bd98ae4c3abc20f43502c94ceea8b10b099835d16ffd9499239029ee73d9669e9b812c8c72d91b8499ccf2e2430092ead466358e4f8ad024f06408d35e69a62bb30bcc2fe36ce48a0a9e3ae1654034ecbdc57500b41d2b779be7c64c4278d63360f9f9915fd89ee154c59b76bafee358ab2821111992b52ed07d7ec1e493e09c41fb4b7ff216e4e8ad502217de35804caa5842aed1d7e6ec7083cb1a851ff66a843de51a839546c5f05b4185b524969b857dab42709816639920356069212c976ccfb4e658826cecb3440372422148ef723cf7c6ed232621dafae5dddaa223a46797a04fece4a43166b824540f04372b88ed7e5012c8468225c51f75dc81e2ff2befe2a18ea03e781e144c84328b13d08010a2b6d06bfb84d7d6a1f1a48d1d824491e63c49a4a6c54cc4e03d8c66a9d2d85dce23026dfae30a2b27a2f151399b74abeecb039310d6969a355a9592b034d64b403294ada49c15f5afc55ffe1d7252d256d03f0e2cf4fb24f7d409fb4eaae87412154cce8a6b8ae7be5940713b9702a35d430e89c189b9cfe10dafa048a2386d6bd56a135188d2418bcef0f0fdbc939454a54793fde1aa08bdebe888b5ecf3cc63156859d8c1f4d020c07671e23b36cd2e758c0eb44b4c566a41e16ff97f1afa030fd5231f80455ed4582912925e93e2b5976f462035723b0f2067bdeeb75c9841209722038ded3803fb59cd2256b9e92bbe287f7cc1cb293766404224e7455ac21636d38a476bcfddd0df294eddba410cdf22c092fcdd265d202ef39491d52d0456f91df5a0d81ea81693375772a8b499a3c5e0c4e0a56deae36850a123778bfe6656af98233a306e761eda451affa0a73959f16a5617a4f28b14e8f7bd547ab71ca377bc6536312792bd90a80c7e5d56a6b9e1354a9f3dc218de2460496262496f937b8b4c2e6df1bcbecd785585675dc43f4930999dc58c9046c618e46d5d6de5cf47ab6e738d9c5e8e1bc0c2a85b20066b91af70baf8cd8c42c5a1725c741a2422019c93864b1f1d8c513e43af29d08e844e2a1dfbc85bbeac6d7d5c4403dc2360b229be2c69618fced70250f2df8e9adf8573777a6f37724a8255f5afaa23cf75274e5a88664a707fbf4548d4cb21146f3d85e8a2964310ccb0685d5df3c26980e258073f06726a3e45f26b4c26c958a5abd1b47c762f814c4d930a5ee74b979e8b3bd9e604676c375343dbe17ca90bad451f5b2b890b8aa0f8f82585649ec5d13c3994df2313139490c4856be50c514da25e8bdd41d36a3089f2d38d508447b21d04103879a83e06ced0a72a344eef061990406555d7ee2dd852959272b3b43ed0f300bb9c54efb7f45aaa6813cd86593ea53aab4382cd893b34b62cf53a69d58000e94e2f83164c3d38290a675168065ead1fed84"
     }
}' 'https://fcm.googleapis.com/fcm/send'

字符串的大小为3098字节,密钥仅为一个,因此该消息的总大小应为let; 4KB,但这是我作为响应

收到的有效载荷
{"error":"MessageTooBig"}

我可以设法发送此消息的唯一方法是用作收件人设备注册ID而不是主题,但是我找不到文档中的任何地方,说明您只能将4K数据发送到单个设备而不是主题。

有人可以向我解释这种行为吗?

这是预期的行为。通过主题发送的消息的有效负载尺寸限制为2KB。从GCM文档(强调我的(:

应用程序服务器将带有有效载荷的消息最多向主题发送到主题,并且GCM处理消息路由并可靠地将消息交付到正确的设备。

我链接了GCM文档,因为它已在此处进行文档,但是由于FCM只是运行GCM作为核心,因此仍然适用。

相关内容

  • 没有找到相关文章

最新更新