Skip to content

Commit f373642

Browse files
committed
docs(websockets): fix redis adapter
1 parent 0fada40 commit f373642

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

content/websockets/adapter.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ import { createClient } from 'redis';
4444
const io = new Server();
4545
const pubClient = createClient({ url: `redis://localhost:6379` });
4646
const subClient = pubClient.duplicate();
47-
const redisAdapter = io.adapter(createAdapter(pubClient, subClient));
47+
48+
pubClient.connect();
49+
subClient.connect();
50+
4851
export class RedisIoAdapter extends IoAdapter {
4952
createIOServer(port: number, options?: ServerOptions): any {
5053
const server = super.createIOServer(port, options);
51-
server.adapter(redisAdapter);
54+
server.adapter(createAdapter(pubClient, subClient));
5255
return server;
5356
}
5457
}

0 commit comments

Comments
 (0)