Skip to content

Commit

Permalink
feat: Enable gzip compression on client side too :)
Browse files Browse the repository at this point in the history
  • Loading branch information
h0n9 committed Jul 8, 2024
1 parent 8ac3228 commit 2e143e6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding/gzip"

pb "github.com/h0n9/msg-lake/proto"
"github.com/postie-labs/go-postie-lib/crypto"
Expand Down Expand Up @@ -139,16 +140,20 @@ func (c *Client) Publish(ctx context.Context, topicID, message string) error {
}

// publish the message
pubRes, err := c.msgLakeClient.Publish(ctx, &pb.PublishReq{
TopicId: topicID,
MsgCapsule: &pb.MsgCapsule{
Data: data,
Signature: &pb.Signature{
PubKey: c.privKey.PubKey().Bytes(),
Data: sigDataBytes,
pubRes, err := c.msgLakeClient.Publish(
ctx,
&pb.PublishReq{
TopicId: topicID,
MsgCapsule: &pb.MsgCapsule{
Data: data,
Signature: &pb.Signature{
PubKey: c.privKey.PubKey().Bytes(),
Data: sigDataBytes,
},
},
},
})
grpc.UseCompressor(gzip.Name),
)
if err != nil {
return err
}
Expand Down

0 comments on commit 2e143e6

Please sign in to comment.