Centrifuge library is a real-time core of the Centrifugo server. It’s also a general-purpose real-time messaging library for Golang programming language. The library is built on top of a strict client-server protocol schema and exposes various real-time oriented primitives for a developer. Centrifuge solves several problems a developer may encounter when building complex real-time applications – like scalability (millions of connections), proper persistent connection management and invalidation, fast reconnect with message recovery and WebSocket fallback option.
Golang Library highlights
- Fast and optimized for low-latency communication with millions of client connections. See test stand with 1 million connections in Kubernetes
- Built-in bidirectional transports: WebSocket (JSON or binary Protobuf) and SockJS (JSON only)
- Possibility to use unidirectional transports without using custom Centrifuge client library: see examples for GRPC, EventSource(SSE), Fetch Streams, Unidirectional WebSocket
- Built-in horizontal scalability with Redis PUB/SUB, consistent Redis sharding, Sentinel and Redis Cluster for HA
- Presence information for channels (show all active clients in a channel)
- Native authentication over HTTP middleware or custom token-based
- Channel concept to broadcast message to all active subscribers
- Client-side and server-side channel subscriptions
- Bidirectional asynchronous message communication and RPC calls
- History information for channels (ephemeral streams with size and TTL retention)
- Join/leave events for channels (aka client goes online/offline)
- Possibility to register a custom PUB/SUB Broker and Presence Manager implementations
- Message recovery mechanism for channels to survive PUB/SUB delivery problems, short network disconnects, or node restart
- Prometheus instrumentation
- Client libraries for main application environments (see below)
For bidirectional communication between a client and a Centrifuge-based server, we have a bunch of client libraries:
- centrifuge-js – for a browser, NodeJS and React Native
- centrifuge-go – for Go language
- centrifuge-dart – for Dart and Flutter
- centrifuge-swift – for native iOS development
- centrifuge-java – for native Android development and general Java
If you opt for unidirectional communication, you may leverage Centrifuge possibilities without any specific library on the client-side – simply by using native browser API or GRPC-generated code. See examples of unidirectional communication over GRPC, EventSource(SSE), Fetch Streams, WebSocket.
There is no ads to display, Please add some