About Caret

Last modified by Zoltan Farkas on 2017/06/29 17:51

About Caret

In this article we present the features Caret provides. Not only the context awareness, but also everything behind and beside, like publish-subscribe-based status delivery, messaging, Caret services, Web Communicator, APIs, SDKs and the infrastructure behind Caret. 

Feature Summary

Caret is not only an application you can find in the App Store or in Google Play - Caret is a complete presence and status based messaging solution with various customization possibilities. The main building blocks of Caret are the followings:

  • Publish-subscribe communication model: Caret devices or services can automatically subscribe to status or message notifications published by other members of the Caret infrastructure,
  • Automatic status publishing: based on the sensors of your device, the Caret application can automatically determine and publish your status,
  • Group handling: you can specify what level of status information to share with whom by placing your contacts into groups, 
  • Caret services, APIs and SDKs: allow you to create your own application publishing custom status information into Caret,
  • Web Communicator: offers a web portal for managing your Caret devices and services,
  • Messaging: Caret devices and services can send and receive chat messages combined with status (including text, photos, contacts, locations) and actions (meeting request, call request),
  • Net calls: Caret users can call each other for free  through Caret - independently of geographical location,
  • End-to-End encryption: Caret users get included end-to-end encryption based on ZeroKit.

Base features

The very core of Caret includes the pub-sub communication model and group handling. Let's assume Alice and Bob both have just installed Caret (for example on an iPhone or an Android device), and are mutually present in each others' address book. In this case after they have finished the registration process, they will see each others' call status in the Caret application. The underlying logic makes both Alice and Bob subscribe to each others' status publication information, so if e.g. Alice publishes a new status information, Bob will receive that information basically immediately. And the other way around, if Bob publishes some information, as Alice is subscribed to Bob's status changes, Alice will receives the information published by Bob.

The set of information published includes call status, location and time zone information:

  • call status: includes availability (available, not available), reason (driving, sleeping, calendar event, event ending time, etc.) and detail (custom text for your call status),
  • location: includes country-, region-, city- and coordinate-level information,
  • time zone: includes the time zone of the device.

This way Caret makes it easy to share detailed status information with your friends. However, people who are subscribed to Alice's status changes not necessarily receive all the above information Alice publishes: the level of information shared can be fine-tuned by the group handling mechanism provided by Caret. The following groups are available, which can be extended with additional ones:

  • Default group: subscribers of Alice in this group will receive only call status availability information, country-level location information, and the time zone published by Alice. If Alice installs Caret for the first time, all contacts in her address book are placed into this group,
  • Trusted group: call status availability and reason, city-level location and time zone is shared,
  • VIP: every information is shared,
  • Blocked: no information is shared at all, contacts in this group will not even see Alice as a Caret user.

An important feature of Caret is the possibility to extend the set of information published, and the specification of new groups, members of which will receive this new information. For example, if Carol develops a Caret service for her restaurant and wants to publish special offers for her regulars, all she needs to do is to create a new group (e.g. "regulars"), add a new status information topic with the new group as the target, put her regular guests into this group, and publish her special offers to the new information topic.

Automatic status triggering

The Caret application is prepared to make use of as many sensors of your device as possible in order to automatically determine your availability. Based on the current or historical status of the different sensors, it may set the status of your phone number to:

  • sleeping or do not disturb: if you have set an automatic sleeping or do not disturb period, and it is active,
  • in vehicle: if based on your historical location data you are in a moving vehicle,
  • event: if there is some active event in your calendar,
  • low battery: if your device's battery is about to discharge soon,
  • silenced: if you have set your device into silent mode.

These are the one Caret is currently capable of detecting. Beside these, Caret offers a way to create your own automatic sensors, for example Alice can develop a new call status called as "At work", which will be triggered when she is at her place of work.

Messaging

Caret applications automatically get chat messaging with advances features. Users can send text messages, photos/images, contact information or location to their Caret contacts. Additionally, Caret also supports sending actions, like invitation for a meeting or asking for a call. The basis of Caret, the status information of users is tightly integrated into the messaging layer, as users can decide on the delivery of messages based on the recipients status. For example, if Alice sees that Bob is traveling, she may send a message to Bob with asking Caret to actually deliver the message only once Bob has finished traveling.

End-to-End encryption

Chat messages sent through Caret are end-to-end encrypted. This means that the message can be decrypted and read only by the two users having the actual conversation. No message is sent out unencrypted if both users 

Net calls

Beside chat messaging, Caret allows its users to call each other through net calls (VoIP) for free, based on Twilio's client call functionality. The following figure shows the big picture here:

Caret architecture.png

Caret Services, Web Communicator, APIs, SDKs

Caret services enable you to publish custom status information. Caret's Application Programming Interface (API) lets users harness their smart device sensors and interconnect them with third party devices & applications to automate customizable status sharing services. Users can share what they are doing in one app when they are doing it via an interactive Caret status. Your status could automatically change when you start playing a game and contain a link, photo and more about that game. For more complex cross-app or sensor triggered statuses, you can order custom built solutions through Caret’s Web Communicator.

Companies can connect their business logic and promotions to enhance their B2C or B2B needs. For example, when users start playing PuzzleWinds, their statuses change to 'Playing PuzzleWinds - join me!'. Companies can also customize additional status personalisation services by integrating their app’s business logic with Caret’s multiple modules.

Caret Service consent architecture

More details on Caret Services and related topics can be found in the Services Page.

Caret Infrastructure

The following figure shows the outline of the Caret infrastructure:

Caret Infrastructure

As it can be seen, the database backend is implemented based on Cassandra. Automatic scaling is applied for this component if the load increases on the database nodes. Additionally, periodic backup is performed.

The additional services, the XMPP layer, REST API and Web Communicator connect to the Cassandra database.

The XMPP layer, implemented based on ejabberd is responsible for providing the publish-subscribe communication model. The ejabberd component has notably been extended to implement Caret features, and to allow connection to the Cassandra database backend. Clients of the XMPP layer are accessing this service through a load balancer, as this layer also applies automatic scaling as necessary.

The REST API component implements various functionalities, like the Public API, registration, VoIP services, and additional endpoints necessary for the proper operation of the client applications (would they be the Caret Application or some other custom Caret-based service). The RESTful support for public APIs provides OAuth2.0 based authorization with Client credentials and Bearer Tokens.

The Web Communicator (portal) layer offers a web interface for managing and registering new services and OAuth2.0 Client credentials & Bearer Tokens.

Caret comparison

There are other systems providing similar functionalities to what Caret offers, like RabbitMQ and Apache Kafka.

RabbitMQ

RabbitMQ is a widespread, open-source message broker, offering distributed setup, scaling and high-availability features. Although RabbitMQ also provides the publish-subscribe messaging pattern, it lacks features what Caret provides - for example only active subscribers will receive the latest published message, meaning that mobile clients implementing a presence system based on RabbitMQ have to ask for additional historical presence information for the application's offline period. Moreover, subscription inside Caret is automatically solved, whereas in case of RabbitMQ developers of the application need to configure additional exchanges in order to have the published information sent to the different subscribers.

The big advantage of RabbitMQ is the availability of API for many programming languages, like Python, Java, JavaScript, Objective-C. Although Caret doesn't have API for so many programming languages, thanks to its simple public API, and the big number of client libraries available for XMPP, writing applications using different programming languages that expose the features of Caret is also a relatively simple task.

Currently, RabbitMQ lacks the support for using Cassandra as its database backend, which is the highly scalable and fault-tolerant database used by Caret.

Apache Kafka

Apache Kafka is a distributed streaming platform, with features similar to RabbitMQ. The core of Kafka is the stream, which receives data published by producers, and subscribers can consume the data of the stream. And advantage of Kafka compared to RabbitMQ pushing it close to Caret is the availability to support offline consumers as well - however, in case of Kafka it is the task of the consumer to keep track of messages processed so far. Thus, a Kafka consumer has to enumerate through all the messages in a stream in order to find the latest relevant one - in case of Caret, this is solved automatically, offline Caret clients becoming available will not receive historical status published, but only the latest one.

Kafka also offers a number of clients for different programming languages, however currently it lacks support for Objective-C and Swift.

Feature matrix

FeatureRabbitMQKafkaCaret
Publish-subscribe communication pattern
Out-of-the-box context-aware status support--
Easy support for offline clients-
Messaging support
Status-based messaging support--
Cassandra database backend-
Scalable application/infrastructure
Out-of-the-box performance-based auto-scaling infrastructure support--
Out-of-the-box yourdomain.caretapp.io hosted production environment--
RESTful public OAuth2.0-based APIs--
Multi-cloud (AWS, Azure, etc.) support--In progress
Mobile app development API-
Historical presence information-
End-to-End encryption--

 

Tags:
Created by Zoltan Farkas on 2017/06/29 13:02