diff options
author | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-02-09 11:53:40 -0800 |
---|---|---|
committer | Tim Emiola <tbetbetbe@users.noreply.github.com> | 2015-02-09 11:53:40 -0800 |
commit | 3c4cb79b0fcff34ab441811b5762843a3d5d140d (patch) | |
tree | b83bb5d10c2ddb7bfdfe858054fb18a1d504e1a8 | |
parent | d2785749f8360e3c38a1400cccc808d2906b988c (diff) | |
parent | 767482b093cfa9faa539aa6574fce9b9ba2ac3a1 (diff) |
Merge pull request #436 from murgatroid99/node_fix_example_servers
Fixed math and stock servers
-rw-r--r-- | src/node/examples/math_server.js | 3 | ||||
-rw-r--r-- | src/node/examples/stock.proto | 14 | ||||
-rw-r--r-- | src/node/examples/stock_server.js | 7 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/node/examples/math_server.js b/src/node/examples/math_server.js index e65cfe3002..e1bd11b5a6 100644 --- a/src/node/examples/math_server.js +++ b/src/node/examples/math_server.js @@ -128,7 +128,8 @@ var server = new Server({ }); if (require.main === module) { - server.bind('localhost:7070').listen(); + server.bind('0.0.0.0:7070'); + server.listen(); } /** diff --git a/src/node/examples/stock.proto b/src/node/examples/stock.proto index efe98d84ff..2bc5c29d17 100644 --- a/src/node/examples/stock.proto +++ b/src/node/examples/stock.proto @@ -35,28 +35,28 @@ package examples; message StockRequest { optional string symbol = 1; optional int32 num_trades_to_watch = 2 [default=0]; -}; +} message StockReply { optional float price = 1; optional string symbol = 2; -}; +} // Interface exported by the server service Stock { // Simple blocking RPC rpc GetLastTradePrice(StockRequest) returns (StockReply) { - }; + } // Bidirectional streaming RPC rpc GetLastTradePriceMultiple(stream StockRequest) returns (stream StockReply) { - }; + } // Unidirectional server-to-client streaming RPC rpc WatchFutureTrades(StockRequest) returns (stream StockReply) { - }; + } // Unidirectional client-to-server streaming RPC rpc GetHighestTradePrice(stream StockRequest) returns (StockReply) { - }; + } -};
\ No newline at end of file +}
\ No newline at end of file diff --git a/src/node/examples/stock_server.js b/src/node/examples/stock_server.js index c188181b77..07cea2ce5f 100644 --- a/src/node/examples/stock_server.js +++ b/src/node/examples/stock_server.js @@ -35,7 +35,7 @@ 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}); @@ -80,4 +80,9 @@ var stockServer = new StockServer({ } }); +if (require.main === module) { + stockServer.bind('0.0.0.0:8080'); + stockServer.listen(); +} + exports.module = stockServer; |