Skip to content

Missing support for nested paths. IO only connects to the root #5375

@hitmands

Description

@hitmands

Describe the bug
Unable to pass a path or a namespace to socket.io-client.

const client = io(`https://test.com/namespace`, { path: 'something/else' });
  • GIVEN: namespace is stripped away, attempt to establish connection to https://test.com/something/else.

  • EXPECTED: Presever namespace and establish connection to https://test.com/namespace/something/else

To Reproduce

Server

Introduce a Namespace

  • // Server built via NestJS
{
  "@nestjs/platform-socket.io": "^11.1.5",
  "socket.io": "^4.8.1"
}
@WebSocketGateway({ path: 'something/else', namespace: 'namespace' })
export class EventsGateway implements OnGatewayInit, OnGatewayConnection {

Browser

import { io } from "socket.io-client";

const socket = io(`https://test.com/namespace`, {
  path: 'something/else'
});

Expected behavior

  • Establish Connection

Platform:

  • Device: Apple Silicon
  • OS: Mac Os 15.5

Additional context

  • prepending the /namespace to the path doesn't work either.

The issue could be here, there seems to be no concept of namespace.

https://github.com/socketio/socket.io/blob/main/packages/socket.io-client/lib/index.ts#L56

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions