|
1 | 1 | import { CommandContribution} from '@theia/core';
|
2 |
| -import { WebSocketConnectionProvider } from '@theia/core/lib/browser'; |
| 2 | +import { RemoteConnectionProvider, ServiceConnectionProvider } from '@theia/core/lib/browser'; |
3 | 3 | import { ContainerModule, injectable } from '@theia/core/shared/inversify';
|
4 | 4 | import { BackendClient, HelloBackendWithClientService, HelloBackendService, HELLO_BACKEND_PATH, HELLO_BACKEND_WITH_CLIENT_PATH } from '../common/protocol';
|
5 | 5 | import { <%= params.extensionPrefix %>CommandContribution} from './<%= params.extensionPath %>-contribution';
|
6 | 6 |
|
7 | 7 | export default new ContainerModule(bind => {
|
8 | 8 | bind(CommandContribution).to(<%= params.extensionPrefix %>CommandContribution).inSingletonScope();
|
9 | 9 | bind(BackendClient).to(BackendClientImpl).inSingletonScope();
|
| 10 | + bind(ServiceConnectionProvider).toSelf().inSingletonScope(); |
10 | 11 |
|
11 | 12 | bind(HelloBackendService).toDynamicValue(ctx => {
|
12 |
| - const connection = ctx.container.get(WebSocketConnectionProvider); |
13 |
| - return connection.createProxy<HelloBackendService>(HELLO_BACKEND_PATH); |
| 13 | + const connection = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider); |
| 14 | + return connection.createProxy(HELLO_BACKEND_PATH); |
14 | 15 | }).inSingletonScope();
|
15 | 16 |
|
16 | 17 | bind(HelloBackendWithClientService).toDynamicValue(ctx => {
|
17 |
| - const connection = ctx.container.get(WebSocketConnectionProvider); |
| 18 | + const connection = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider); |
18 | 19 | const backendClient: BackendClient = ctx.container.get(BackendClient);
|
19 |
| - return connection.createProxy<HelloBackendWithClientService>(HELLO_BACKEND_WITH_CLIENT_PATH, backendClient); |
| 20 | + return connection.createProxy(HELLO_BACKEND_WITH_CLIENT_PATH, backendClient); |
20 | 21 | }).inSingletonScope();
|
21 | 22 | });
|
22 | 23 |
|
|
0 commit comments