googlearchive / go-gcm

GCM library for Go.
Apache License 2.0
103 stars 66 forks source link

Long multicast_id #43

Open Andrushk opened 8 years ago

Andrushk commented 8 years ago

After attempt to send message:

gcm.SendHttp(apiKey, message)

I'm receiving error:

error sending request to GCM HTTP server: error unmarshaling json from body: json: cannot unmarshal number 7168156478862157292 into Go value of type int

DebugMode = true:

sending:{"to":"dQmz...CRyA","data":{"message":"hello world"}} received body:{"multicast_id":7168156478862157292,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1469779167530028%d86f1c9df9fd7ecd"}]}

May be is necessary to change the type of HttpResponse.MulticastId to int64 or string?

Michael-Stanford commented 7 years ago

I had this problem and changed from int to int64, these type declarations:

multicastID at line 110 (in type HttpResponse struct) multicastID at line 475 (in func sendHttp) mid at line 523 (in func buildRespForMulticast)

which seemed to fix it.

I presume the issue is that for int, Go uses the default int size of the platform, and my server happens to be running on 32 bit Linux.