My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Quick tips: increase GRPC message size in GO

Tom Skellan's photo
Tom Skellan
·Jun 2, 2020

This article will be short. Few weeks ago I encounter some problem with GRPC in Go, after finding out the problem, it is because of max message sizes around 4MB, then I change few things and now its working.

In this tutorial, I will increase the message size both on client and server.

on client:

maxMsgSize     = 10000648
conn, err := grpc.Dial(
        "localhost:80",
        grpc.WithInsecure(),
        grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize), grpc.MaxCallSendMsgSize(maxMsgSize)),
)

on server:

maxMsgSize = 10331648
s := grpc.NewServer(
        grpc.MaxMsgSize(maxMsgSize),
        grpc.MaxRecvMsgSize(maxMsgSize),
        grpc.MaxSendMsgSize(maxMsgSize),
)

That's all folks, checkout fancy text generator or generate cool text to obscure unicode chars with fancy unicode text converter