Skip to content

Go WebSocket client for Centrifugo and Centrifuge library

License

Notifications You must be signed in to change notification settings

silischev/centrifuge-go

 
 

Repository files navigation

GoDoc

Websocket client for Centrifuge library and Centrifugo server.

There is no v1 release of this library yet – API still evolves. At the moment patch version updates only contain backwards compatible changes, minor version updates can have backwards incompatible API changes.

Feature matrix

  • connect to server using JSON protocol format
  • connect to server using Protobuf protocol format
  • connect with token (JWT)
  • connect with custom header
  • automatic reconnect in case of errors, network problems etc
  • an exponential backoff for reconnect
  • connect and disconnect events
  • handle disconnect reason
  • subscribe on a channel and handle asynchronous Publications
  • handle Join and Leave messages
  • handle Unsubscribe notifications
  • reconnect on subscribe timeout
  • publish method of Subscription
  • unsubscribe method of Subscription
  • presence method of Subscription
  • presence stats method of Subscription
  • history method of Subscription
  • top-level publish method
  • top-level presence method
  • top-level presence stats method
  • top-level history method
  • top-level unsubscribe method
  • send asynchronous messages to server
  • handle asynchronous messages from server
  • send RPC commands
  • publish to channel without being subscribed
  • subscribe to private channels with token (JWT)
  • connection token (JWT) refresh
  • private channel subscription token (JWT) refresh
  • handle connection expired error
  • handle subscription expired error
  • ping/pong to find broken connection
  • message recovery mechanism for client-side subscriptions
  • server-side subscriptions
  • message recovery mechanism for server-side subscriptions
  • history stream pagination

Run tests

First run Centrifugo instance:

docker run -d -p 8000:8000 centrifugo/centrifugo:latest centrifugo --client_insecure

Then run go test

About

Go WebSocket client for Centrifugo and Centrifuge library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%