# socket.io-rethinkdb

> RethinkDB adapter for Socket.io

Latest version **0.0.5** (published 2015-07-01) · 0 weekly downloads

## Install

```sh
npm install socket.io-rethinkdb
pnpm add socket.io-rethinkdb
yarn add socket.io-rethinkdb
bun add socket.io-rethinkdb
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2015-07-01 |
| First published | 2015-06-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 20 |
| Maintainers | thejsj |

## Links

- npm: https://www.npmjs.com/package/socket.io-rethinkdb
- Repository: https://github.com/thejsj/socket.io-rethinkdb
- Issues: https://github.com/thejsj/socket.io-rethinkdb/issues
- npm.io page: https://npm.io/package/socket.io-rethinkdb

## Dependencies (6)

- [uid2](https://npm.io/package/uid2.md) 0.0.3
- [debug](https://npm.io/package/debug.md) 0.7.4
- [rethinkdb](https://npm.io/package/rethinkdb.md) ^2.0.2
- [msgpack-js](https://npm.io/package/msgpack-js.md) 0.3.0
- [rethinkdb-init](https://npm.io/package/rethinkdb-init.md) 0.0.4
- [socket.io-adapter](https://npm.io/package/socket.io-adapter.md) 0.3.1

## Recent versions

- 0.0.5 (latest) — 2015-07-01
- 0.0.4 — 2015-07-01
- 0.0.2 — 2015-06-30
- 0.0.1 — 2015-06-29

## README

# socket.io-rethinkdb

[![Build Status](https://travis-ci.org/thejsj/socket.io-rethinkdb.svg?branch=master)](https://travis-ci.org/thejsj/socket.io-rethinkdb)
[![npm version](https://badge.fury.io/js/socket.io-rethinkdb.svg)](http://badge.fury.io/js/socket.io-rethinkdb)

## How to use

```js
var io = require('socket.io')(3000);
var rethinkdb = require('socket.io-rethinkdb');
io.adapter(redis({ host: 'localhost', port: 28015 }));
```

## API

### adapter(uri[, opts])

`uri` is a string like `localhost:28015` where your rehtinkdb instance
is located. For a list of options see below.

### adapter(opts)

The following options are allowed:

- `host`: host to connect to redis on (`localhost`)
- `port`: port to connect to redis on (`28015`)
- `db`: database in which to store messages (`socketio_rethinkdb`)
- `save_messages`: whether the database should keep sent message (or delete them automatically) (`false`)
- `durability_hard`: whether messages have to be written to disk before being acknowledged (`false`)

## When to use

Because of the differences between Redis and RethinkDB, it's not best to use this 
driver over [socket.io-redis](http://github.com/Automattic/socket.io-redis). 
Redis' pub/sub mechanism (which socket.io-redis uses) is not persistent and 
doesn't save your messages to the database. For that reasons, it's faster 
and can handle more messages being concurrently saved to it. 

Hence, you should use this module instead of socket.io-redis if:

1. RethinkDB is alreaydy part of your stack and you don't want another database
2. You need your messages to be persistent

## Guarantees

Messages broadcasted/emitted through the socket connection are guaranteed to 
be written, if acknowledged. But, because of the nature of changefeeds, messages 
are not guaranteed to be delivered. This is similar to the guarantees currently 
provided by Redis pub/sub and socket.io-redis.

## Credit

This module is a fork of [socket.io-redis](http://github.com/Automattic/socket.io-redis).

## License

MIT

---
_Source: https://npm.io/package/socket.io-rethinkdb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
