Skip to content

dvirops/crystalcent

Repository files navigation

Crystalcent

Docs GitHub release Build Status

crystalcent is a Centrifugo API wrapper writes with Crystal Language.

Inspired from gitlab.

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  cent:
    github: devops-israel/crystalcent
  1. Run shards install

Usage

require "cent"

# configuration
endpoint = "https://cent.example.com" # No tailing forward slash
api_key = "<api_key>"

# initialize a new client with user and password for basic auth
centrifugo_client = Cent.client(endpoint, api_key)
# => #<Cent::Client:0x101653f20 @endpoint="https://cent.example.com", @api_key="xxx">

# server health
centrifugo_client.available?
# true

centrifugo_client.publish("channel_x", {text: "value1"})
centrifugo_client.broadcast(["channel_x", "channel_y"], {"stam" => "data"})
centrifugo_client.unsubscribe("channel_x", "user_x")
centrifugo_client.disconnect("user_x")
centrifugo_client.presence("channel_x")
centrifugo_client.presence_stats("channel_x")
centrifugo_client.history("channel_x")
centrifugo_client.channels
centrifugo_client.info

Implemented API

Completed

API

  • POST /api - Main API endpoint for all actions

Supported API calls:

  • publish
  • broadcast
  • unsubscribe
  • disconnect
  • presence
  • presence_stats
  • history
  • channels
  • info

Server Health

Development

Prerequisites

Commands

  • From inside the root of the project run docker-compose up
  • The container is configured to run tests every time a file is changed so just start developing.

Contributing

  1. Fork it (https://github.com/devops-israel/crystalcent/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

License

MIT License © devops-israel

About

Centrifugo API library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages