<commit_before># Longhouse [![Circle CI](https://circleci.com/gh/usecanvas/longhouse.svg?style=svg&circle-token=<PASSWORD>)](https://circleci.com/gh/usecanvas/longhouse)

Simple user presence.

## Prerequisites

- nvm

## Install

```sh
git clone <EMAIL>:usecanvas/longhouse.git
cd longhouse
nvm install
nvm use
npm i
echo "REDIS_URL=redis://localhost:6379" > .env
npm run dev
```

## Use

Longhouse provides an interface for establishing and tracking user presence in
a given namespace. It supports the following actions:

### `join`

Joins the given namespace:

```json
{
  "action"  : "join",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

This will prompt Longhouse to send an ack message back with the current list of
members:

```json
{
  "action" : "join",
  "members": ["<EMAIL>"]
}
```

### `ping`

Longhouse only marks users as present for a finite amount of time before
assuming they have left (the default is 60 seconds). A user can tell Longhouse
that they're still present by sending a ping:

```json
{
  "action"  : "ping",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

Longhouse will acknowledge with a response ping:

```json
{
  "action": "ping"
}
```

### `leave`

A user may leave a space by sending a leave message:

```json
{
  "action"  : "leave",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

Longhouse will acknowledge by sending an ack leave message:

```json
{
  "action": "leave"
}
```<commit_msg>Add subscription information to README<commit_after># Longhouse [![Circle CI](https://circleci.com/gh/usecanvas/longhouse.svg?style=svg&circle-token=e95e3468f9e06bfea17fa9321426ef52dd3bca8e)](https://circleci.com/gh/usecanvas/longhouse)

Simple user presence.

## Prerequisites

- nvm

## Install

```sh
git clone <EMAIL>:usecanvas/longhouse.git
cd longhouse
nvm install
nvm use
npm i
echo "REDIS_URL=redis://localhost:6379" > .env
npm run dev
```

## Use

Longhouse provides an interface for establishing and tracking user presence in
a given namespace. It supports the following actions:

### Actions

#### `join`

Joins the given namespace:

```json
{
  "action"  : "join",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

This will prompt Longhouse to send an ack message back with the current list of
members:

```json
{
  "action" : "join",
  "members": ["<EMAIL>"]
}
```

#### `ping`

Longhouse only marks users as present for a finite amount of time before
assuming they have left (the default is 60 seconds). A user can tell Longhouse
that they're still present by sending a ping:

```json
{
  "action"  : "ping",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

Longhouse will acknowledge with a response ping:

```json
{
  "action": "ping"
}
```

#### `leave`

A user may leave a space by sending a leave message:

```json
{
  "action"  : "leave",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

Longhouse will acknowledge by sending an ack leave message:

```json
{
  "action": "leave"
}
```

### Subscription Events

When a user has joined a space via a `join` action, they are then subscribed to
events on that action. They will be subscribed until they leave or their
connection closes.

Users will not receive subscription events for their own actions.

#### `remote join`

A user has joined a space to which the client is subscribed.

```json
{
  "action"  : "remote join",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

#### `remote expire`

A user's presence has expired from a space to which the client is subscribed.

```json
{
  "action"  : "remote expire",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```

#### `remote leave`

A user has left a space to which the client is subscribed.

```json
{
  "action"  : "remote leave",
  "space"   : "5e01bce8-76eb-4179-abf4-358975da3c94",
  "identity": "<EMAIL>"
}
```
{'fraction_non_alphanumeric': 0.1459206310081341, 'fraction_numerical': 0.052748336209021446, 'mean_word_length': 4.236129032258065, 'pattern_counts': {'":': 15, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7333026', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1473, 'n_words': 446}