Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
  • Loading branch information
tsmaeder committed Dec 1, 2023
1 parent a675b1d commit 06d8df2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/browser/connection-status-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import * as sinon from 'sinon';

import { Container } from 'inversify';
import { ILogger, Emitter, Loggable } from '../common';
import { WebsocketConnectionSource } from './messaging/ws-connection-source';
import { WebSocketConnectionSource } from './messaging/ws-connection-source';

disableJSDOM();

Expand Down Expand Up @@ -101,7 +101,7 @@ describe('frontend-connection-status', function (): void {
let timer: sinon.SinonFakeTimers;
let pingSpy: sinon.SinonSpy;
beforeEach(() => {
const mockWebSocketConnectionSource = sinon.createStubInstance(WebsocketConnectionSource);
const mockWebSocketConnectionSource = sinon.createStubInstance(WebSocketConnectionSource);
const mockPingService: PingService = <PingService>{
ping(): Promise<void> {
return Promise.resolve(undefined);
Expand All @@ -118,7 +118,7 @@ describe('frontend-connection-status', function (): void {
testContainer.bind(PingService).toConstantValue(mockPingService);
testContainer.bind(ILogger).toConstantValue(mockILogger);
testContainer.bind(ConnectionStatusOptions).toConstantValue({ offlineTimeout: OFFLINE_TIMEOUT });
testContainer.bind(WebsocketConnectionSource).toConstantValue(mockWebSocketConnectionSource);
testContainer.bind(WebSocketConnectionSource).toConstantValue(mockWebSocketConnectionSource);

sinon.stub(mockWebSocketConnectionSource, 'onSocketDidOpen').value(mockSocketOpenedEmitter.event);
sinon.stub(mockWebSocketConnectionSource, 'onSocketDidClose').value(mockSocketClosedEmitter.event);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/connection-status-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Event, Emitter } from '../common/event';
import { DefaultFrontendApplicationContribution } from './frontend-application-contribution';
import { StatusBar, StatusBarAlignment } from './status-bar/status-bar';
import { Disposable, DisposableCollection, nls } from '../common';
import { WebsocketConnectionSource } from './messaging/ws-connection-source';
import { WebSocketConnectionSource } from './messaging/ws-connection-source';

/**
* Service for listening on backend connection changes.
Expand Down Expand Up @@ -119,7 +119,7 @@ export class FrontendConnectionStatusService extends AbstractConnectionStatusSer

private scheduledPing: number | undefined;

@inject(WebsocketConnectionSource) protected readonly wsConnectionProvider: WebsocketConnectionSource;
@inject(WebSocketConnectionSource) protected readonly wsConnectionProvider: WebSocketConnectionSource;
@inject(PingService) protected readonly pingService: PingService;

@postConstruct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { ContainerModule } from 'inversify';
import { BrowserFrontendIdProvider, FrontendIdProvider } from './frontend-id-provider';
import { WebsocketConnectionSource } from './ws-connection-source';
import { WebSocketConnectionSource } from './ws-connection-source';
import { LocalConnectionProvider, RemoteConnectionProvider, ServiceConnectionProvider } from './service-connection-provider';
import { ConnectionSource } from './connection-source';
import { ConnectionCloseService, connectionCloseServicePath } from '../../common/messaging/connection-management';
Expand All @@ -28,11 +28,11 @@ export const messagingFrontendModule = new ContainerModule(bind => {
bind(ConnectionCloseService).toDynamicValue(ctx => WebSocketConnectionProvider.createProxy(ctx.container, connectionCloseServicePath)).inSingletonScope();
bind(BrowserFrontendIdProvider).toSelf().inSingletonScope();
bind(FrontendIdProvider).toService(BrowserFrontendIdProvider);
bind(WebsocketConnectionSource).toSelf().inSingletonScope();
bind(WebSocketConnectionSource).toSelf().inSingletonScope();
bind(backendServiceProvider).toDynamicValue(ctx => {
bind(ServiceConnectionProvider).toSelf().inSingletonScope();
const container = ctx.container.createChild();
container.bind(ConnectionSource).toService(WebsocketConnectionSource);
container.bind(ConnectionSource).toService(WebSocketConnectionSource);
return container.get(ServiceConnectionProvider);
}).inSingletonScope();
bind(LocalConnectionProvider).toService(backendServiceProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { SocketWriteBuffer } from '../../common/messaging/socket-write-buffer';
import { ConnectionManagementMessages } from '../../common/messaging/connection-management';

@injectable()
export class WebsocketConnectionSource implements ConnectionSource {
export class WebSocketConnectionSource implements ConnectionSource {
static readonly NO_CONNECTION = '<none>';

@inject(FrontendIdProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

import { injectable } from 'inversify';
import { Endpoint } from '../../browser/endpoint';
import { WebsocketConnectionSource } from '../../browser/messaging/ws-connection-source';
import { WebSocketConnectionSource } from '../../browser/messaging/ws-connection-source';

export function getLocalPort(): string | undefined {
const params = new URLSearchParams(location.search);
return params.get('localPort') ?? undefined;
}

@injectable()
export class ElectronLocalWebSocketConnectionSource extends WebsocketConnectionSource {
export class ElectronLocalWebSocketConnectionSource extends WebSocketConnectionSource {

protected override createEndpoint(path: string): Endpoint {
const localPort = getLocalPort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import { ConnectionSource } from '../../browser/messaging/connection-source';
import { LocalConnectionProvider, RemoteConnectionProvider, ServiceConnectionProvider } from '../../browser/messaging/service-connection-provider';
import { WebSocketConnectionProvider } from '../../browser';
import { ConnectionCloseService, connectionCloseServicePath } from '../../common/messaging/connection-management';
import { WebsocketConnectionSource } from '../../browser/messaging/ws-connection-source';
import { WebSocketConnectionSource } from '../../browser/messaging/ws-connection-source';

const backendServiceProvider = Symbol('backendServiceProvider2');
const localServiceProvider = Symbol('localServiceProvider');

export const messagingFrontendModule = new ContainerModule(bind => {
bind(ConnectionCloseService).toDynamicValue(ctx => WebSocketConnectionProvider.createProxy(ctx.container, connectionCloseServicePath)).inSingletonScope();
bind(ElectronWebSocketConnectionSource).toSelf().inSingletonScope();
bind(WebsocketConnectionSource).toService(ElectronWebSocketConnectionSource);
bind(WebSocketConnectionSource).toService(ElectronWebSocketConnectionSource);
bind(ElectronIpcConnectionSource).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toService(ElectronIpcConnectionSource);
bind(ElectronLocalWebSocketConnectionSource).toSelf().inSingletonScope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

import { injectable } from 'inversify';
import { FrontendApplicationContribution } from '../../browser/frontend-application-contribution';
import { WebsocketConnectionSource } from '../../browser/messaging/ws-connection-source';
import { WebSocketConnectionSource } from '../../browser/messaging/ws-connection-source';

/**
* Customized connection provider between the frontend and the backend in electron environment.
* This customized connection provider makes sure the websocket connection does not try to reconnect
* once the electron-browser window is refreshed. Otherwise, backend resources are not disposed.
*/
@injectable()
export class ElectronWebSocketConnectionSource extends WebsocketConnectionSource implements FrontendApplicationContribution {
export class ElectronWebSocketConnectionSource extends WebSocketConnectionSource implements FrontendApplicationContribution {
constructor() {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import * as http from 'http';
import * as https from 'https';
import { AddressInfo } from 'net';
import { servicesPath } from '../../../common';
import { WebsocketConnectionSource } from '../../../browser/messaging/ws-connection-source';
import { WebSocketConnectionSource } from '../../../browser/messaging/ws-connection-source';
import { Container, inject } from 'inversify';
import { RemoteConnectionProvider, ServiceConnectionProvider } from '../../../browser/messaging/service-connection-provider';
import { messagingFrontendModule } from '../../../browser/messaging/messaging-frontend-module';
import { Socket, io } from 'socket.io-client';

const websocketUrl = Symbol('testWebsocketUrl');
class TestWebsocketConnectionSource extends WebsocketConnectionSource {
class TestWebsocketConnectionSource extends WebSocketConnectionSource {
@inject(websocketUrl)
readonly websocketUrl: string;

Expand Down Expand Up @@ -55,7 +55,7 @@ export class TestWebSocketChannelSetup {
const container = new Container();
container.bind(websocketUrl).toConstantValue(socketUrl);
container.load(messagingFrontendModule);
container.rebind(WebsocketConnectionSource).to(TestWebsocketConnectionSource);
container.rebind(WebSocketConnectionSource).to(TestWebsocketConnectionSource);
return container.get(RemoteConnectionProvider);
}
}

0 comments on commit 06d8df2

Please sign in to comment.