NAME
Google::gRPC::Engine - HTTP/2 transport engine factory for Google::gRPC (NGHTTP2 XS with Pure-Perl fallback)
SYNOPSIS
use Google::gRPC::Engine;
# Auto-select NGHTTP2 (C/XS) with automatic fallback to PP (Pure-Perl)
my $engine = Google::gRPC::Engine->create(
on_headers => sub { my ($sid, $headers) = @_; ... },
on_data => sub { my ($sid, $chunk) = @_; ... },
on_trailers => sub { my ($sid, $trailers)= @_; ... },
on_stream_close => sub { my ($sid, $code) = @_; ... },
);
# Explicitly select a specific engine
my $pp_engine = Google::gRPC::Engine->create(engine => 'PP');
DESCRIPTION
Google::gRPC::Engine is the factory class used by Google::gRPC::Channel to instantiate an HTTP/2 framing/session engine. By default it attempts to load the C/XS Google::gRPC::Engine::NGHTTP2 engine (backed by libnghttp2) and automatically falls back to the Pure-Perl Google::gRPC::Engine::PP engine (backed by Protocol::HTTP2) if libnghttp2 is unavailable.
METHODS
create( %args )
my $engine = Google::gRPC::Engine->create(
engine => 'NGHTTP2', # optional: 'NGHTTP2' or 'PP'
on_headers => \&on_headers_cb,
on_data => \&on_data_cb,
on_trailers => \&on_trailers_cb,
on_stream_close => \&on_stream_close_cb,
);
Instantiates and returns a transport engine object. If engine is omitted, tries NGHTTP2 first and falls back to PP.
SEE ALSO
Google::gRPC, Google::gRPC::Channel, Google::gRPC::Engine::NGHTTP2, Google::gRPC::Engine::PP
AUTHOR
C.J. Collier <cjac@google.com>
LICENSE
Apache License 2.0