flatbuffers/grpc/examples
2025-07-16 12:07:08 -07:00
..
go Bump google.golang.org/grpc in /grpc/examples/go/greeter/client (#8131) 2023-11-18 12:12:44 -08:00
python/greeter Bugfix: grpc python code generation location and file suffix (#8359) 2025-06-24 22:52:40 -07:00
swift/Greeter Moves away from @_exported import to add the import in the generated code (#8637) 2025-07-16 12:07:08 -07:00
ts/greeter Make eslint less pedantic (#8012) 2023-07-10 15:48:16 +00:00
greeter.fbs
README.md

Languages known issues

Python

  • Assert the type required in your server/client since python is able to receive Bytes array or utf8 strings.
def SayHello(self, request, context):
    # request might be a byte array or a utf8 string

    r = HelloRequest.HelloRequest().GetRootAs(request, 0)
    reply = "Unknown"
    if r.Name():
        reply = r.Name()
    # Issues might happen if type checking isnt present.
    # thus encoding it as a `reply.decode('UTF-8')`
    return build_reply("welcome " + reply.decode('UTF-8'))

This can be prevented by making sure all the requests coming to/from python are Bytes array

def say_hello(stub, builder):
    hello_request = bytes(builder.Output())
    reply = stub.SayHello(hello_request)
    r = HelloReply.HelloReply.GetRootAs(reply)
    print(r.Message())

Go

  • Always requires the content-type of the payload to be set to application/grpc+flatbuffers

example: .SayHello(ctx, b, grpc.CallContentSubtype("flatbuffers"))