aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/examples/stock_server.js
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-02-10 09:19:06 -0800
committerGravatar murgatroid99 <mlumish@google.com>2015-02-10 09:19:06 -0800
commit7dcc363aa714575c9377800f6499366cf9079819 (patch)
treef6046fa205141a563a4c2e0da0c4a680d10da66e /src/node/examples/stock_server.js
parentcd0b90621dd2b404d93b169836f02b1694b1f45c (diff)
parent3116d4f0fef9ac1e39a434dc6521109f1e0cffbf (diff)
Resolved merge conflicts
Diffstat (limited to 'src/node/examples/stock_server.js')
-rw-r--r--src/node/examples/stock_server.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/node/examples/stock_server.js b/src/node/examples/stock_server.js
index c188181b77..b226a71573 100644
--- a/src/node/examples/stock_server.js
+++ b/src/node/examples/stock_server.js
@@ -35,10 +35,10 @@ var _ = require('underscore');
var grpc = require('..');
var examples = grpc.load(__dirname + '/stock.proto').examples;
-var StockServer = grpc.makeServerConstructor([examples.Stock.service]);
+var StockServer = grpc.buildServer([examples.Stock.service]);
function getLastTradePrice(call, callback) {
- callback(null, {price: 88});
+ callback(null, {symbol: call.request.symbol, price: 88});
}
function watchFutureTrades(call) {
@@ -80,4 +80,9 @@ var stockServer = new StockServer({
}
});
-exports.module = stockServer;
+if (require.main === module) {
+ stockServer.bind('0.0.0.0:8080');
+ stockServer.listen();
+}
+
+module.exports = stockServer;