Skip to main content

Unidirectional GRPC

It's possible to connect to GRPC unidirectional stream to consume real-time messages from Centrifugo. In this case you need to generate GRPC code for your language on client-side.

Protobuf definitions can be found here.

tip

We publish Centrifugo GRPC uni stream Protobuf definitions to Buf Schema Registry. This means that it's possible to depend on pre-generated Protobuf definitions for your programming language instead of manually generating them from the schema file (see SDKs supported by Buf registry here).

GRPC server will start on port 11000 (default).

Supported data formats​

JSON and binary.

Options​

uni_grpc​

Boolean, default: false.

Enables unidirectional GRPC endpoint.

config.json
{
...
"uni_grpc": true
}

uni_grpc_port​

String, default "11000".

Port to listen on.

uni_grpc_address​

String, default "" (listen on all interfaces)

Address to bind uni GRPC to.

uni_grpc_max_receive_message_size​

Default: 65536 (64KB)

Maximum allowed size of a first connect message received from GRPC connection in bytes.

uni_grpc_tls​

Boolean, default: false

Enable custom TLS for unidirectional GRPC server.

uni_grpc_tls_cert​

String, default: "".

Path to cert file.

uni_grpc_tls_key​

String, default: "".

Path to key file.

Example​

We have example for Go language. In general, the algorithm is like this:

  1. Copy Protobuf definitions
  2. Generate GRPC client code
  3. Use generated code to connect to Centrifugo
  4. Process Push messages, drop unknown Pushes, handle those necessary for the application.