Moved "extension/ui" to "webview", removed "shared".

This commit is contained in:
Henning Dieterichs
2020-02-29 21:31:22 +01:00
parent f55bef23c2
commit 5318b5e4ae
56 changed files with 144 additions and 116 deletions

View File

@@ -1,7 +1,6 @@
import { WebSocketStream } from "@hediet/typed-json-rpc-websocket";
import { AddressInfo } from "net";
import WebSocket = require("ws");
import { join } from "path";
import { ConnectionHandler } from "./ConnectionHandler";
import { Sources } from "./DataSource";
import * as express from "express";
@@ -9,6 +8,7 @@ import * as http from "http";
import * as serveStatic from "serve-static";
import { Config } from "./Config";
import cryptoRandomString = require("crypto-random-string");
import { distPath } from "debug-visualizer-webview";
export class Server {
private server: http.Server;
@@ -16,11 +16,17 @@ export class Server {
constructor(sources: Sources, config: Config) {
const app = express();
const distPath = join(__dirname, "../ui/dist");
app.use(serveStatic(distPath));
this.server = app.listen();
console.log(
`Serving "${distPath}" on port ${
(this.server.address() as AddressInfo).port
}`
);
const wss = new WebSocket.Server({ server: this.server });
wss.on("connection", ws => {
const stream = new WebSocketStream(ws);