blob: 9fec9793560bdf303edaf8562ed1560d5f34ae66 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
var inherits = require('util').inherits;
var vanadium = require('vanadium');
var pingpong = require('../pingpong');
function PingPongService() {}
inherits(PingPongService, pingpong.PingPong);
PingPongService.prototype.ping = function(ctx, message) {
console.log('[' + ctx.remoteBlessingStrings + '] ' + message);
return Promise.resolve('PONG');
};
var pingPongService = new PingPongService();
vanadium.init(function(err, rt) {
if (err) throw err;
console.log('Starting server');
rt.newServer().serve('pingpong', pingPongService, function(err) {
if (err) throw err;
console.log('Serving pingpong');
});
});