Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosiakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Jul 20, 2017
1 parent c400245 commit a62900a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
13 changes: 8 additions & 5 deletions doc/Developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,28 @@ This command does a few things:

## Run the browser-based example application

We can start the application from examples/browser directory with:
We can start the application from the examples/browser directory with:

npm start

This command starts the backend application, a small web server and a browser
tab with the frontend.

If you rebuild native node packages for electron then
rollback these changes before starting the browser example
by running from the root directory:

npm run rebuild:web

## Run the electron-based example application

From the root directory run:

npm run rebuild:electron

This command rebuilds native node packages against the version of node used by electron.
To rollback changes run:

npm run rebuild:web

It can also be started with from examples/electron directory:
It can also be started from the examples/electron directory with:

npm start

Expand Down
19 changes: 14 additions & 5 deletions doc/Internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ILoggerServer, ILoggerClient } from '../../application/common/logger-pr

export const loggerServerModule = new ContainerModule(bind => {
bind(ConnectionHandler).toDynamicValue(ctx =>
new JsonRpcConnectionHandler<ILoggerClient>("/logger", client => {
new JsonRpcConnectionHandler<ILoggerClient>("/services/logger", client => {
const loggerServer = ctx.container.get<ILoggerServer>(ILoggerServer);
loggerServer.setClient(client);
return loggerServer;
Expand Down Expand Up @@ -124,7 +124,7 @@ To dig more into ContributionProvider see this [section](#contribution-providers
So now:
``` typescript
new JsonRpcConnectionHandler<ILoggerClient>("/logger", client => {
new JsonRpcConnectionHandler<ILoggerClient>("/services/logger", client => {
```
This does a few things if we look at this class implementation:
Expand Down Expand Up @@ -198,6 +198,15 @@ And it returns the loggerServer as the object that will be exposed over JSON-RPC
This connects the factory to the connection.
The endpoints with `services/*` path are served by the webpack dev server, see `webpack.config.js`:
``` javascript
'/services/*': {
target: 'ws://localhost:3000',
ws: true
},
```
## Connecting to a service
So now that we have a backend service let's see how to connect to it from
Expand All @@ -220,7 +229,7 @@ export const loggerFrontendModule = new ContainerModule(bind => {
bind(ILoggerServer).toDynamicValue(ctx => {
const loggerWatcher = ctx.container.get(LoggerWatcher);
const connection = ctx.container.get(WebSocketConnectionProvider);
return connection.createProxy<ILoggerServer>("/logger", loggerWatcher.getLoggerClient());
return connection.createProxy<ILoggerServer>("/services/logger", loggerWatcher.getLoggerClient());
}).inSingletonScope();
});
```
Expand All @@ -231,7 +240,7 @@ The important bit here are those lines:
bind(ILoggerServer).toDynamicValue(ctx => {
const loggerWatcher = ctx.container.get(LoggerWatcher);
const connection = ctx.container.get(WebSocketConnectionProvider);
return connection.createProxy<ILoggerServer>("/logger", loggerWatcher.getLoggerClient());
return connection.createProxy<ILoggerServer>("/services/logger", loggerWatcher.getLoggerClient());
}).inSingletonScope();
```
Expand All @@ -255,7 +264,7 @@ See more information about how events works in theia [here](events).
Here we're getting the websocket connection, this will be used to create a proxy from.
``` typescript
return connection.createProxy<ILoggerServer>("/logger", loggerWatcher.getLoggerClient());
return connection.createProxy<ILoggerServer>("/services/logger", loggerWatcher.getLoggerClient());
```
So here at the last line we're binding the ILoggerServer interface to a
Expand Down

0 comments on commit a62900a

Please sign in to comment.