Skip to content
Snippets Groups Projects
Commit a1bc750b authored by Alexander Tim Hobelsberger's avatar Alexander Tim Hobelsberger
Browse files

async redis connection

parent aa907a49
No related branches found
No related tags found
1 merge request!10Skalierbarkeit
...@@ -36,11 +36,18 @@ var port = process.env.PORT || 3000; ...@@ -36,11 +36,18 @@ var port = process.env.PORT || 3000;
const redis = require('socket.io-redis'); const redis = require('socket.io-redis');
const { createClient } = require('redis'); const { createClient } = require('redis');
const { createAdapter } = require('@socket.io/redis-adapter'); const { createAdapter } = require('@socket.io/redis-adapter');
/*
const pubClient = createClient({ host: 'host.docker.internal', port: 6379}); const pubClient = createClient({ host: 'redis-server', port: 6379});
const subClient = pubClient.duplicate(); const subClient = pubClient.duplicate();
io.adapter(createAdapter(pubClient, subClient)); io.adapter(createAdapter(pubClient, subClient)); */
(async () => {
pubClient = createClient({ url: "redis://redis-server:6379" });
await pubClient.connect();
subClient = pubClient.duplicate();
io.adapter(createAdapter(pubClient, subClient));
})();
//DB Connection //DB Connection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment