A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://grafana.com/docs/k6/latest/javascript-api/k6-net-grpc/stream/stream-end/ below:

Stream.end() | Grafana k6 documentation

import { Client, Stream } from 'k6/net/grpc';
import { sleep } from 'k6';

const client = new Client();
client.load([], '../../grpc_server/route_guide.proto');

export default () => {
  if (__ITER == 0) {
    client.connect('127.0.0.1:10000', { plaintext: true });
  }

  const stream = new Stream(client, 'main.RouteGuide/RecordRoute');

  stream.on('data', (stats) => {
    console.log('Finished trip with', stats.pointCount, 'points');
    console.log('Passed', stats.featureCount, 'features');
    console.log('Traveled', stats.distance, 'meters');
    console.log('It took', stats.elapsedTime, 'seconds');
  });

  // send 2 items
  stream.write({ latitude: 406109563, longitude: -742186778 });
  stream.write({ latitude: 416802456, longitude: -742370183 });

  // send end-signal to the server
  stream.end();

  sleep(1);
};

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4