我尝试使用此JSON发送FCM消息:
{"数据" {" before_end":" -941.813993"" before_start":" 341.813993&# 34;," ended_at":" 1480427700"" ID":" 5""现在":&# 34; 1480426758"" started_at":" 1480427100""亚型":" IN10""类型&#34 ;:" chat_schedule"}"至":" /主题/ 13_notif"" registration_ids":[" ffM9IdvHBmY:APA91bF2LEUfxv_S8tmjfQccQR8VW_Yx9Zp25rrLbkIc9WnMeBh2tRfdMcDPsFqA6uqnIKFWLAygrVcr -98_krTikm8GeYC41kha-eoZ987HhPmbJNT7Eeo-UyHr7hJ6grS9PEm7q1ep"" fgKJA8e2U_o:APA91bG09ZnKjNZxpnZmthmX5MR1A-hD3nepqCz0HesckF2HU6nS8MFJYbNX_OUH33ep6ZedN8UPy8AtSWQj4pkSrNTqPRb8pDGxhjSljpr-DvJ_7nwlAXc2SiNsV-XtNq4nfc8tZaqq"" dlubMvP6e1k:APA91bEOmnkELD9HdlQMMPBm2KwWaiku7WpOixDzpAALr7VFO5sWQAkJjbYYphdLAV_4Hqlh8_9ixraebA3hn6I3CemLmqpnnR67jYq5fjtpTUqKldO6dtiZSMBZ6E9aZdwrrPxf_gUW"" cKD8A2Rp2iw:APA91bF86nwk_SZIyVdymyiNgiTGlEr8YX4P44Hv7QXv6FcYyvswBV0mnYTbCEkj8dUAusPB8FXoC_9r0b9U1bNh7DScfUEHlF9KjHzy nnwtyUmP0nCaWBBCW4CYn1YK01y_8uWAoPTJ"" elN6OMhyhJ8:APA91bEQjALiSwtOzI84U9h5VgTji_pqBqF61K3By7-3u4cn_WQZSay9NkqXK4sSzj1wk6AsBhlD5wvQXmrddBn54mlAq5OeXA88fX0zGpx-nO6i2FtQ8OHyI8TwuASj2QrB7IFYkrxU&#34],"通知":{}}
但有时它在响应结构中显示400:
&fcm.FcmResponseStatus{
Ok: false,
StatusCode: 400,
MulticastId: 0,
Success: 0,
Fail: 0,
Canonical_ids: 0,
Results: nil,
MsgId: 0,
Err: "",
RetryAfter: "",
}
我谷歌一段时间之后,400意味着:
400仅适用于JSON请求。表示请求无法解析为JSON,或者包含无效字段(例如,传递一个字符串,其中包含预期的数字)。在响应中描述了确切的失败原因,并且在重试请求之前应该解决问题。
对于其他json,它没有显示400:
{"数据" {" before_end":" 2613"" before_start":" -4074" " ended_at":" 1480424100"" ID":" 5""现在":" 1480426713"" started_at":" 1480422639""亚型":"在-1""类型&#34 ;:" chat_schedule"}"至":" /主题/ 13_notif""通知":{}}
回应是:
&fcm.FcmResponseStatus{
Ok: true,
StatusCode: 200,
MulticastId: 0,
Success: 0,
Fail: 0,
Canonical_ids: 0,
Results: nil,
MsgId: 5721749585709774290,
Err: "",
RetryAfter: "",
}
可能有什么问题?
答案 0 :(得分:0)
没关系,我不应该在JSON上使用registration_ids
和to
。
更多详细信息github.com/NaySoftware/go-fcm
可能无法重复发送广播主题然后重新注册,反之亦然,我们必须使用不同的客户端,或者必须首先清除To
和RegistrationIds
被重用。