Skip to content

TypeError: io.of is not a function when using namespace in websocket gateway #87

@pooooriya

Description

@pooooriya

https://github.com/socketio/socket.io-admin-ui/blob/158864989dddeba67df9975a4cad48ef310f8c80/lib/index.ts#L543C32-L543C38

@WebSocketGateway(8080, {
namespace: 'chat',
cors: {
origin: '*',
credentials: true,
},
})

afterInit() {
instrument(this.server, {
auth: false,
mode: 'production',
});
}

// error TypeError: io.of is not a function

how to fix : remove namespace from @websocketgateway

// correct way

@WebSocketGateway(8080, {
cors: {
origin: '*',
credentials: true,
},
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions