Skip to content

Sound field not working in version 1.18 #791

@ZaninAndrea

Description

@ZaninAndrea

We recently upgraded from gorush 1.16 to 1.18.2 (we are using the gRPC api). In the 1.18.2 version the support for the sound field seems to be broken, while it was working in v1.16: we use FCM to send push notifications to iOS (I didn't test the case with FCM sending to android) and even if we set Sound: "default" the notification doesn't play any sound (it is shown on the iPhone correctly though).

You can reproduce using the following test case

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/appleboy/gorush/rpc/proto"
	"google.golang.org/grpc"
)

func Connect() proto.GorushClient {
	// Set up a connection to the server.
	conn, err := grpc.Dial("localhost:9000", grpc.WithInsecure())
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}
	return proto.NewGorushClient(conn)
}

func main() {
	gorushClient := Connect()

	ctx := context.Background()
	res, _ := gorushClient.Send(ctx, &proto.NotificationRequest{
		Platform:         2,
		Title:            "TEST",
		Message:          "test",
		Priority:         proto.NotificationRequest_HIGH,
		PushType:         "alert",
		MutableContent:   true,
		ContentAvailable: true,
		Sound:            "default",
		Tokens:           []string{"TOKEN_OMITTED"},
	})

	fmt.Println("Sent notification:", res)
}

Running this test case against gorush 1.16 sends a notification with sound, while using gorush 1.18 the notification arrives without sound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions