Skip to content

Theia creates 2 web-sockets if we override the WebSocketConnectionProvider class #13094

@safisa

Description

@safisa

Bug Description:

Hi,
It could be difficult to explain the issue I am facing on the latest Theia (1.43.1), but I will try:

I have a class that extends the WebSocketConnectionProvider:

export class CustomWebSocketConnectionProvider extends WebSocketConnectionProvider {
    protected override createWebSocket(url: string): Socket {
        ...
    }
}

And here is the binding code:

bind(CustomWebSocketConnectionProvider).toSelf().inSingletonScope();
rebind(WebSocketConnectionProvider).toService(CustomWebSocketConnectionProvider);

It was working correctly until I upgraded to 1.43.1 (from 1.40). I see now in the dev-tools on the network tab that there are two web sockets, and only one is actually working (before that there was only one).

If I debug the code from dev-tools and put a breakpoint inside the createWebSocket method in both classes (CustomWebSocketConnectionProvider and the base WebSocketConnectionProvider class), and reload the page, the break point breaks in both of them! this should not be the case, since I override this class and rebind it to the new one.

I think this issue is caused by the Remote SSH PR from 1.43: #12618

Steps to Reproduce:

  1. create a new class that extends the WebSocketConnectionProvider
  2. it can be an empty class, no need to override anything
  3. add the binding as above
  4. reload and check the network tab with WS filtering
  5. you will see 2 WS
  6. also you can override the createWebSocket, you can just call the super once, and put the breakpoint as described above..

Additional Information

  • Operating System: Mac
  • Theia Version: 1.43.1

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