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.
GRPC server will start on port 11000
(default).
Supported data formats
JSON and binary.
Options
uni_grpc
Boolean, default: false
.
Enables unidirectional GRPC endpoint.
{
...
"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
A basic example can be found here. It uses Go language, but for other languages approach is mostly the same:
- Copy Protobuf definitions
- Generate GRPC client code
- Use generated code to connect to Centrifugo
- Process Push messages, drop unknown Push types, handle those necessary for the application.