Skip to content

Commit

Permalink
feat: rename the package to @socket.io/redis-adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed May 11, 2021
1 parent 7931420 commit 3cac178
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

```js
const io = require('socket.io')(3000);
const redisAdapter = require('socket.io-redis');
const redisAdapter = require('@socket.io/redis-adapter');
io.adapter(redisAdapter({ host: 'localhost', port: 6379 }));
```

### ES6 modules

```js
import { Server } from 'socket.io';
import redisAdapter from 'socket.io-redis';
import redisAdapter from '@socket.io/redis-adapter';

const io = new Server(3000);
io.adapter(redisAdapter({ host: 'localhost', port: 6379 }));
Expand All @@ -53,7 +53,7 @@ io.adapter(redisAdapter({ host: 'localhost', port: 6379 }));
```ts
// npm i -D @types/redis
import { Server } from 'socket.io';
import { createAdapter } from 'socket.io-redis';
import { createAdapter } from '@socket.io/redis-adapter';
import { RedisClient } from 'redis';

const io = new Server(8080);
Expand All @@ -63,7 +63,7 @@ const subClient = pubClient.duplicate();
io.adapter(createAdapter({ pubClient, subClient }));
```

By running Socket.IO with the `socket.io-redis` adapter you can run
By running Socket.IO with the `@socket.io/redis-adapter` adapter you can run
multiple Socket.IO instances in different processes or servers that can
all broadcast and emit events to and from each other.

Expand Down Expand Up @@ -248,7 +248,7 @@ Access the `pubClient` and `subClient` properties of the
Redis Adapter instance to subscribe to its `error` event:

```js
const adapter = require('socket.io-redis')('localhost:6379');
const adapter = require('@socket.io/redis-adapter')('localhost:6379');
adapter.pubClient.on('error', function(){});
adapter.subClient.on('error', function(){});
```
Expand All @@ -258,7 +258,7 @@ also be forwarded to the adapter instance:

```js
const io = require('socket.io')(3000);
const redisAdapter = require('socket.io-redis');
const redisAdapter = require('@socket.io/redis-adapter');
io.adapter(redisAdapter({ host: 'localhost', port: 6379 }));
io.of('/').adapter.on('error', function(){});
```
Expand All @@ -271,7 +271,7 @@ a connection string.

```js
const redis = require('redis');
const redisAdapter = require('socket.io-redis');
const redisAdapter = require('@socket.io/redis-adapter');
const pubClient = redis.createClient(port, host, { auth_pass: "pwd" });
const subClient = pubClient.duplicate();
io.adapter(redisAdapter({ pubClient, subClient }));
Expand All @@ -283,7 +283,7 @@ io.adapter(redisAdapter({ pubClient, subClient }));

```js
const io = require('socket.io')(3000);
const redisAdapter = require('socket.io-redis');
const redisAdapter = require('@socket.io/redis-adapter');
const Redis = require('ioredis');

const startupNodes = [
Expand All @@ -307,7 +307,7 @@ io.adapter(redisAdapter({

```js
const io = require('socket.io')(3000);
const redisAdapter = require('socket.io-redis');
const redisAdapter = require('@socket.io/redis-adapter');
const Redis = require('ioredis');

const options = {
Expand All @@ -326,7 +326,7 @@ io.adapter(redisAdapter({

## Protocol

The `socket.io-redis` adapter broadcasts and receives messages on particularly named Redis channels. For global broadcasts the channel name is:
The `@socket.io/redis-adapter` adapter broadcasts and receives messages on particularly named Redis channels. For global broadcasts the channel name is:
```
prefix + '#' + namespace + '#'
```
Expand All @@ -343,7 +343,7 @@ prefix + '#' + namespace + '#' + room + '#'

A number of other libraries adopt this protocol including:

- [socket.io-emitter](https://github.com/socketio/socket.io-emitter)
- [socket.io-redis-emitter](https://github.com/socketio/socket.io-redis-emitter)
- [socket.io-python-emitter](https://github.com/GameXG/socket.io-python-emitter)
- [socket.io-emitter-go](https://github.com/stackcats/socket.io-emitter-go)

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "socket.io-redis",
"name": "@socket.io/redis-adapter",
"version": "6.1.0",
"description": "",
"description": "The Socket.IO Redis adapter, allowing to broadcast events between several Socket.IO servers",
"license": "MIT",
"repository": {
"type": "git",
"url": "[email protected]:socketio/socket.io-redis.git"
"url": "[email protected]:socketio/socket.io-redis-adapter.git"
},
"files": [
"dist/"
Expand Down

0 comments on commit 3cac178

Please sign in to comment.