require "grpc"
require "grpc/http2"
require "./protobufs/hello_world_services.pb"
require "./protobufs/hello_world.pb"
class GreeterHandler < Greeter
# You can define your own initialize method to inject dependencies
def say_hello(request : ::HelloRequest) : ::HelloReply
if name = request.name
HelloReply.new(message: "Hello #{name}")
else
HelloReply.new(message: "Howdy Pardner")
end
end
def say_hello_again(request : ::HelloRequest) : ::HelloReply
if name = request.name
HelloReply.new(message: "Hello again #{name}")
else
HelloReply.new(message: "Howdy again Pardner")
end
end
end
grpc = GRPC::Server.new
grpc << GreeterHandler.new
server = HTTP2::ClearTextServer.new([grpc])
server.listen "0.0.0.0", 5001
c:\windows_home\src\dsisnero\crystal_examples\grpc_test>bin\grpc_server.exe
Unhandled exception in spawn: huffman string padding is larger than 7-bits (HTTP2::HPACK::Error)
from lib\grpc\src\hpack.cr:113 in 'string'
from lib\grpc\src\http2.cr:368 in '->'
from C:\windows_home.local\share\scoop\apps\crystal\current\src\fiber.cr:141 in 'run'
@dsisnero Apologies, I got distracted on my way to push the fix. It's been released in v0.1.6. Feel free to close if this solves the issue you're seeing.
c:\windows_home\src\dsisnero\crystal_examples\grpc_test>bin\grpc_server.exe Unhandled exception in spawn: huffman string padding is larger than 7-bits (HTTP2::HPACK::Error) from lib\grpc\src\hpack.cr:113 in 'string' from lib\grpc\src\http2.cr:368 in '->' from C:\windows_home.local\share\scoop\apps\crystal\current\src\fiber.cr:141 in 'run'