Public | Automated Build

Last pushed: a month ago
Short Description
Short description is empty for this repo.
Full Description

What is Sugar?

Sugar is a server side event notification system to deliver event data payloads to subscribed clients.
By default it will attempt to connect the client to the server using websockets and will fall back to long polling.

See for the client implementation details.

How it works

The server is a wrapper around Redis pub/sub ( and real time events ( connections all via a HTTP API.

The HTTP end points are:

  1. get '/presence'
    • list the subscribed user counts for all channels
  2. get '/active_users?channel=zooniverse'
    • list the subscribed users for a specific channel
  3. post '/notify'
    • send a 'notification' message to a specific private user channel
  4. post '/announce'
    • broadcast an 'announcement' message to a specific section channel, e.g. (project-1 || zooniverse)
  5. post '/experiment'
    • send a 'experiment' message to a specific private user channel

All requests to the post end points must include a formatted message body for the matching event type as described below.

The 3 types of messages the system accepts are:

  1. Notifications
     {"notifications": [{"user_id": "1", "message": "Hiya", "url": "test", "section": "zooniverse", "delivered": "false"}]}
  2. Announcements
    {"announcements": [{"message": "announcment message", "url": "test", "section": "zooniverse", "delivered": "false"}]}
  3. Experiments
    {"experiments": [{"user_id": "1", "message": "would you like to participate?", "url": "test", "section": "zooniverse", "delivered": "false"}]}

Manual testing of notifications

Construct per user notification payloads in JSON and use something like cURL to POST the payload to the notifications server.

curl -vv \
     -X "POST" "" \
     -H 'Content-Type: application/json' \
     -u 'username:password' \
     -d $'{
  "notifications": [{
    "message": "A message from curl to user 1",
    "section": "zooniverse",
    "user_id": "1",
    "url": "",
    "delivered": false


Visit for debug user & testing section announcements and user notifications.

Docker Pull Command
Source Repository