cent

Version, currently master branch1 version
  • master branchlatestJun 6, 2019

github.com/dvirops/crystalcent

Centrifugo API library

3 stars
0 dependents
License: MIT

The last crawl could not reach this repository on its host: dvirops/crystalcent has moved: that owner and name no longer address a repository on GitHub. The entry stays because repositories come back, and because other shards still link to it.

Installation

# Add this to your shard.yml
dependencies:
  cent:
    github: dvirops/crystalcent
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.29.0
License
MIT
Author
Josh Dvir

Dependencies

Runtime Dependencies

  • halite0.10.0github: icyleaf/halite

Development Dependencies

  • webmock*github: manastech/webmock.crdev

README

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

  • GET /health - returns 200 OK (you need to configure Centrifugo to allow (health endpoint)[https://centrifugal.github.io/centrifugo/server/configuration/#healthcheck-endpoint])

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