UNPKG

raas-server

Version:
32 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const rpc = require("vscode-jsonrpc"); const messageHandler_1 = require("./messageHandler"); const raas_core_1 = require("raas-core"); class Client { constructor(socket, id) { this.onDisconnected = new raas_core_1.rhamtEvents.TypedEvent(); this.socket = socket; this.id = id; this.listenToSocket(); } listenToSocket() { this.socket.on('close', this.dispose.bind(this)); this.socket.on('error', () => { this.socket.destroy(); }); } register(runtimeService, notificationService, installableServerService, installationService) { this.connection = rpc.createMessageConnection(new rpc.StreamMessageReader(this.socket), new rpc.StreamMessageWriter(this.socket)); this.messageHandler = new messageHandler_1.MessageHandler(this.connection, runtimeService, installableServerService, installationService); } listen() { this.messageHandler.listen(); } dispose() { this.connection.dispose(); this.onDisconnected.emit(undefined); } } exports.Client = Client; //# sourceMappingURL=client.js.map