Skip to content

TypeError: socket.client.writeToEngine is not a function #424

Closed
@aintHuman

Description

@aintHuman

Getting the following error trying to get redis working with socketio and express.

TypeError: socket.client.writeToEngine is not a function
at <PROJECT_DIRECTORY>/server/node_modules/@socket.io/redis-adapter/node_modules/socket.io-adapter/dist/index.js:119:31

Few others here have also flagged this, but I don't see any workaround. socket.io-redis-adapter is the latest version, 7.0.0.

My socketio instance is being created like this:

--

// Create the SocketIO Server
const express = require('express');
const http = require('http');
const sio = require('socket.io');
const redisAdapter = require('@socket.io/redis-adapter');
const { createClient } = require("redis");

.
.
.
const app = express();
const server = http.createServer(app);
const io = new sio.Server(server);
const pubClient = createClient({
port : [redacted],
host : [redacted],
password : [redacted]
});
const subClient = pubClient.duplicate()
io.adapter(redisAdapter(pubClient, subClient));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions