function runRouteChat(callback) {
  var call = client.routeChat();
  call.on('data', function(note) {
    console.log('Got message "' + note.getMessage() + '" at ' +
        note.getLocation().getLatitude() + ', ' +
        note.getLocation().getLongitude());
  });

  call.on('end', callback);

  var notes = [{
    location: {
      latitude: 0,
      longitude: 0
    },
    message: 'First message'
  }, {
    location: {
      latitude: 0,
      longitude: 1
    },
    message: 'Second message'
  }, {
    location: {
      latitude: 1,
      longitude: 0
    },
    message: 'Third message'
  }, {
    location: {
      latitude: 0,
      longitude: 0
    },
    message: 'Fourth message'
  }];
  for (var i = 0; i < notes.length; i++) {
    var note = notes[i];
    console.log('Sending message "' + note.message + '" at ' +
        note.location.latitude + ', ' + note.location.longitude);
    var noteMsg = new messages.RouteNote();
    noteMsg.setMessage(note.message);
    var location = new messages.Point();
    location.setLatitude(note.location.latitude);
    location.setLongitude(note.location.longitude);
    noteMsg.setLocation(location);
    call.write(noteMsg);
  }
  call.end();
}
function runRouteChat(callback) {
  var call = client.routeChat();
  call.on('data', function(note) {
    console.log('Got message "' + note.getMessage() + '" at ' +
        note.getLocation().getLatitude() + ', ' +
        note.getLocation().getLongitude());
  });

  call.on('end', callback);

  var notes = [{
    location: {
      latitude: 0,
      longitude: 0
    },
    message: 'First message'
  }, {
    location: {
      latitude: 0,
      longitude: 1
    },
    message: 'Second message'
  }, {
    location: {
      latitude: 1,
      longitude: 0
    },
    message: 'Third message'
  }, {
    location: {
      latitude: 0,
      longitude: 0
    },
    message: 'Fourth message'
  }];
  for (var i = 0; i < notes.length; i++) {
    var note = notes[i];
    console.log('Sending message "' + note.message + '" at ' +
        note.location.latitude + ', ' + note.location.longitude);
    var noteMsg = new messages.RouteNote();
    noteMsg.setMessage(note.message);
    var location = new messages.Point();
    location.setLatitude(note.location.latitude);
    location.setLongitude(note.location.longitude);
    noteMsg.setLocation(location);
    call.write(noteMsg);
  }
  call.end();
}
function runRouteChat ( callback ) { var call = client . routeChat ( ) ; call . on ( 'data' , function ( note ) { console . log ( 'Got message "' + note . getMessage ( ) + '" at ' + note . getLocation ( ) . getLatitude ( ) + ', ' + note . getLocation ( ) . getLongitude ( ) ) ; } ) ; call . on ( 'end' , callback ) ; var notes = [ { location : { latitude : 0 , longitude : 0 } , message : 'First message' } , { location : { latitude : 0 , longitude : 1 } , message : 'Second message' } , { location : { latitude : 1 , longitude : 0 } , message : 'Third message' } , { location : { latitude : 0 , longitude : 0 } , message : 'Fourth message' } ] ; for ( var i = 0 ; i < notes . length ; i ++ ) { var note = notes [ i ] ; console . log ( 'Sending message "' + note . message + '" at ' + note . location . latitude + ', ' + note . location . longitude ) ; var noteMsg = new messages . RouteNote ( ) ; noteMsg . setMessage ( note . message ) ; var location = new messages . Point ( ) ; location . setLatitude ( note . location . latitude ) ; location . setLongitude ( note . location . longitude ) ; noteMsg . setLocation ( location ) ; call . write ( noteMsg ) ; } call . end ( ) ; }
Run the routeChat demo. Send some chat messages, and print any chat messages
that are sent from the server.
@param {function} callback Called when the demo is complete
Run the routeChat demo . Send some chat messages and print any chat messages that are sent from the server .
Run the route chat