The idea is to allow relatively flexible visualisations in the browser, while minimising rendering load on the server.
24 lines
705 B
TypeScript
24 lines
705 B
TypeScript
import { FigureRequest, FigureUpdate } from './figure_pb.js';
|
|
import { FigureServiceClient } from './FigureServiceClientPb';
|
|
|
|
export function connect(host: string) {
|
|
var figureService = new FigureServiceClient(host);
|
|
var request = new FigureRequest();
|
|
|
|
var stream = figureService.getFigure(request);
|
|
stream.on('data', function(response: FigureUpdate) {
|
|
if (response.hasFigure()) {
|
|
console.log("Got new figure");
|
|
}
|
|
else {
|
|
console.log("Got figure update");
|
|
}
|
|
});
|
|
stream.on('status', function(status: any) {
|
|
console.log("Status:", status);
|
|
});
|
|
stream.on('end', function() {
|
|
console.log("End");
|
|
});
|
|
}
|