当我尝试向 Expo Push Notification 服务器发送通知时,我收到“x.509 certificate signed by unknown authority”错误消息。我用 Golang 编写的服务器存储了 expo 推送令牌。然后,它加载这些令牌并构建列表并使用函数expo.PushMessage推送它们。PublishMultiple我有两台服务器,一台用于测试,另一台用于生产。它在测试服务器中运行良好。我在测试手机上收到了推送通知。所以,我更新了我的生产服务器,然后生产服务器产生x.509 certificate signed by unknown authority消息。首先,我怀疑我的 expo 推送令牌已损坏,但是当我使用Expo 推送通知工具时推送令牌运行良好。我不确定在哪里寻找解决方案。谁能帮我?如果您想了解我的服务器代码或设置,我会修改问题。目前,我不确定应该提供哪部分代码或设置来找到解决方案。以下代码是唯一可能发生错误的地方。import ( expo "github.com/oliveroneill/exponent-server-sdk-golang/sdk" "github.com/pkg/errors")type Client struct { PushClient *expo.PushClient}func NewClient() *Client { client := expo.NewPushClient(nil) return &Client{PushClient: client}}func (c *Client) PushNotifications(deviceKeys []string, title string, body string) (error, map[string]string) { messages := make([]expo.PushMessage, 0) for _, deviceKey := range deviceKeys { pushToken, err := expo.NewExponentPushToken(deviceKey) if err != nil { continue } messages = append(messages, expo.PushMessage{ To: pushToken, Body: body, Data: nil, Sound: "default", Title: title, Priority: expo.DefaultPriority, ChannelID: "default", }) } // This is only place the error can occur // PublishMultiple function is a part of the Expo SDK responses, err := c.PushClient.PublishMultiple(messages) if err != nil { return errors.WithStack(err), nil } sentErrors := make(map[string]string) for index, response := range responses { err := response.ValidateResponse() if err != nil && index >= len(deviceKeys) { sentErrors[deviceKeys[index]] = err.Error() } } return nil, sentErrors}
- 1 回答
- 0 关注
- 190 浏览
添加回答
举报
0/150
提交
取消