Replies: 1 comment
-
|
@jimbglenn two things going on here: 1. upgrade to the older v0.2.x uses v0.3.0 fixes this by using npm install @socket.io/redis-streams-adapter@latest2. move engine.io hooks into the const http = createServer(app);
// create socket.io FIRST
const io = new Server(http, {
adapter: createStreamsAdapter(pubClient),
});
io.on('connection', function (socket) {
// ...
});
// THEN listen
http.listen(port, () => {
console.log(`Server running on port ${port}`);
});for reference, the regular const pubClient = createClient({ url: '...' });
const subClient = pubClient.duplicate();the streams adapter v0.3.0 handles this internally now via ref: redis-streams-adapter changelog | socket.io redis adapter docs | node-redis isolation pool issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Whenever I tried to add the redis-streams-adapter, my webserver stops responding.
I'm using redis-streams-adapter to use Valkey.
I assume I'm putting the adapter code in the right place.
Any guidance?
Full example:
Beta Was this translation helpful? Give feedback.
All reactions