UNPKG

vscode-ws-jsonrpc

Version:
26 lines 899 B
/* -------------------------------------------------------------------------------------------- * Copyright (c) 2024 TypeFox and others. * Licensed under the MIT License. See LICENSE in the package root for license information. * ------------------------------------------------------------------------------------------ */ import { AbstractMessageWriter } from 'vscode-jsonrpc/lib/common/messageWriter.js'; export class WebSocketMessageWriter extends AbstractMessageWriter { errorCount = 0; socket; constructor(socket) { super(); this.socket = socket; } end() { } async write(msg) { try { const content = JSON.stringify(msg); this.socket.send(content); } catch (e) { this.errorCount++; this.fireError(e, msg, this.errorCount); } } } //# sourceMappingURL=writer.js.map