How to use the vscode-jsonrpc.SocketMessageReader function in vscode-jsonrpc

To help you get started, we’ve selected a few vscode-jsonrpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
const server = net.createServer(socket => {
          this.initialized = false;
          server.close();
          this.eventEmitter.emit('connect');
          socket.on('close', () => this.onSocketClosed());

          this.logger.info('langserver connection established on port ' + this.targetPort);

          const reader = new SocketMessageReader(socket);
          const writer = new SocketMessageWriter(socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          res(this.clientConnection);
        });
        server.on('error', rej);
github graphql / graphiql / packages / graphql-language-service-server / src / startServer.ts View on Github external
.createServer(client => {
            client.setEncoding('utf8');
            reader = new SocketMessageReader(client);
            writer = new SocketMessageWriter(client);
            client.on('end', () => {
              socket.close();
              process.exit(0);
            });
            const connection = createMessageConnection(reader, writer, logger);
            addHandlers(connection, logger, options.configDir);
            connection.listen();
          })
          .listen(port);
github elastic / kibana / x-pack / legacy / plugins / code / server / lsp / proxy.ts View on Github external
const server = net.createServer(socket => {
      this.initialized = false;
      server.close();
      this.currentServer = null;
      socket.on('close', () => this.onSocketClosed());
      this.eventEmitter.off('changePort', server.close);
      this.logger.info('langserver connection established on port ' + this.targetPort);
      const reader = new SocketMessageReader(socket);
      const writer = new SocketMessageWriter(socket);
      this.clientConnection = createMessageConnection(reader, writer, this.logger);
      this.registerOnNotificationHandler(this.clientConnection);
      this.clientConnection.listen();
      this.eventEmitter.emit('connect');
    });
    server.on('error', this.setError);
github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
this.socket.on('connect', () => {
          const reader = new SocketMessageReader(this.socket);
          const writer = new SocketMessageWriter(this.socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          resolve(this.clientConnection);
          this.eventEmitter.emit('connect');
        });
github elastic / kibana / x-pack / plugins / code / server / lsp / proxy.ts View on Github external
const server = net.createServer(socket => {
          this.initialized = false;
          server.close();
          this.eventEmitter.emit('connect');
          socket.on('close', () => this.onSocketClosed());

          this.logger.info('langserver connection established on port ' + this.targetPort);

          const reader = new SocketMessageReader(socket);
          const writer = new SocketMessageWriter(socket);
          this.clientConnection = createMessageConnection(reader, writer, this.logger);
          this.registerOnNotificationHandler(this.clientConnection);
          this.clientConnection.listen();
          res(this.clientConnection);
        });
        server.on('error', rej);
github atom / atom-languageclient / lib / auto-languageclient.ts View on Github external
private createRpcConnection(process: LanguageServerProcess): rpc.MessageConnection {
    let reader: rpc.MessageReader;
    let writer: rpc.MessageWriter;
    const connectionType = this.getConnectionType();
    switch (connectionType) {
      case 'ipc':
        reader = new rpc.IPCMessageReader(process as cp.ChildProcess);
        writer = new rpc.IPCMessageWriter(process as cp.ChildProcess);
        break;
      case 'socket':
        reader = new rpc.SocketMessageReader(this.socket);
        writer = new rpc.SocketMessageWriter(this.socket);
        break;
      case 'stdio':
        reader = new rpc.StreamMessageReader(process.stdout);
        writer = new rpc.StreamMessageWriter(process.stdin);
        break;
      default:
        return Utils.assertUnreachable(connectionType);
    }

    return rpc.createMessageConnection(reader, writer, {
      log: (..._args: any[]) => { },
      warn: (..._args: any[]) => { },
      info: (..._args: any[]) => { },
      error: (...args: any[]) => {
        this.logger.error(args);
github last-hit-aab / last-hit / plugins / lib / extension-rpc.ts View on Github external
const server = net.createServer((socket: net.Socket) => {
				server.close();
				connectResolve({
					reader: new rpc.SocketMessageReader(socket, encoding),
					writer: new rpc.SocketMessageWriter(socket, encoding)
				});
			});
			server.on('error', reject);
github TypeFox / vscode-ws-jsonrpc / src / server / launch.ts View on Github external
export function createSocketConnection(outSocket: net.Socket, inSocket: net.Socket, onDispose: () => void): IConnection {
    const reader = new SocketMessageReader(outSocket);
    const writer = new SocketMessageWriter(inSocket);
    return createConnection(reader, writer, onDispose);
}