otto/eventbus/README.adoc

2.0 KiB

<html lang="en"> <head> </head>

Otto Eventbus

THe eventbus is the core of the Otto ecosystem, which provides stateless pubsub channels and stateful queues over WebSocket connections.

Other services in the Otto ecosystem are expected to register for events by subscribing to different channels. Events from these channels will be received over a single WebSocket connection.

API

All messages to ("inputs") and from ("outputs") the eventbus are serialized as JSON.

WebSocket connections must be initiated to http://EVENTBUS_URL/ws/.

Inputs

Subscribe

{
  "meta" : {
    "channel" : "<channel name>",
    "ts" : "<iso-8601 timestamp>"
  },
  "msg" : {
    "type" : "subscribe",
    "client" : "<client uuid>"
  }
}

Unsubscribe

{
  "meta" : {
    "channel" : "<channel name>",
    "ts" : "<iso-8601 timestamp>"
  },
  "msg" : {
    "type" : "unsubscribe",
    "client" : "<client uuid>"
  }
}

Publish

{
  "meta" : {
    "channel" : "<channel name>",
    "ts" : "<iso-8601 timestamp>"
  },
  "msg" : {
    "type" : "publish",
    "_comment" : "The payload can be any arbitrary JSON object",
    "payload" : {
      "<arbitrary>" : "<json>"
    }
  }
}

Outputs

Heartbeat

{
  "meta" : {
    "channel" : "<channel name>",
    "ts" : "<iso-8601 timestamp>"
  },
  "msg" : {
    "type" : "heartbeat"
  }
}

Message

{
  "meta" : {
    "channel" : "<channel name>",
    "ts" : "<iso-8601 timestamp>"
  },
  "msg" : {
    "type" : "message",
    "_comment" : "The payload can be any arbitrary JSON object",
    "payload" : {
      "<arbitrary>" : "<json>"
    }
  }
}

Implementations

The Otto eventbus is intended to provide an API shim which can be easily ported to a number of backend durable queueing and eventing systems.

There are currently no other implementations other than the in-memory implementation in this directory.

</html>