Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
3c4cb79b
Commit
3c4cb79b
authored
10 years ago
by
Tim Emiola
Browse files
Options
Downloads
Plain Diff
Merge pull request #436 from murgatroid99/node_fix_example_servers
Fixed math and stock servers
parents
d2785749
767482b0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/node/examples/math_server.js
+2
-1
2 additions, 1 deletion
src/node/examples/math_server.js
src/node/examples/stock.proto
+7
-7
7 additions, 7 deletions
src/node/examples/stock.proto
src/node/examples/stock_server.js
+6
-1
6 additions, 1 deletion
src/node/examples/stock_server.js
with
15 additions
and
9 deletions
src/node/examples/math_server.js
+
2
−
1
View file @
3c4cb79b
...
@@ -128,7 +128,8 @@ var server = new Server({
...
@@ -128,7 +128,8 @@ var server = new Server({
});
});
if
(
require
.
main
===
module
)
{
if
(
require
.
main
===
module
)
{
server
.
bind
(
'
localhost:7070
'
).
listen
();
server
.
bind
(
'
0.0.0.0:7070
'
);
server
.
listen
();
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/node/examples/stock.proto
+
7
−
7
View file @
3c4cb79b
...
@@ -35,28 +35,28 @@ package examples;
...
@@ -35,28 +35,28 @@ package examples;
message
StockRequest
{
message
StockRequest
{
optional
string
symbol
=
1
;
optional
string
symbol
=
1
;
optional
int32
num_trades_to_watch
=
2
[
default
=
0
];
optional
int32
num_trades_to_watch
=
2
[
default
=
0
];
}
;
}
message
StockReply
{
message
StockReply
{
optional
float
price
=
1
;
optional
float
price
=
1
;
optional
string
symbol
=
2
;
optional
string
symbol
=
2
;
}
;
}
// Interface exported by the server
// Interface exported by the server
service
Stock
{
service
Stock
{
// Simple blocking RPC
// Simple blocking RPC
rpc
GetLastTradePrice
(
StockRequest
)
returns
(
StockReply
)
{
rpc
GetLastTradePrice
(
StockRequest
)
returns
(
StockReply
)
{
}
;
}
// Bidirectional streaming RPC
// Bidirectional streaming RPC
rpc
GetLastTradePriceMultiple
(
stream
StockRequest
)
returns
rpc
GetLastTradePriceMultiple
(
stream
StockRequest
)
returns
(
stream
StockReply
)
{
(
stream
StockReply
)
{
}
;
}
// Unidirectional server-to-client streaming RPC
// Unidirectional server-to-client streaming RPC
rpc
WatchFutureTrades
(
StockRequest
)
returns
(
stream
StockReply
)
{
rpc
WatchFutureTrades
(
StockRequest
)
returns
(
stream
StockReply
)
{
}
;
}
// Unidirectional client-to-server streaming RPC
// Unidirectional client-to-server streaming RPC
rpc
GetHighestTradePrice
(
stream
StockRequest
)
returns
(
StockReply
)
{
rpc
GetHighestTradePrice
(
stream
StockRequest
)
returns
(
StockReply
)
{
}
;
}
};
}
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/node/examples/stock_server.js
+
6
−
1
View file @
3c4cb79b
...
@@ -35,7 +35,7 @@ var _ = require('underscore');
...
@@ -35,7 +35,7 @@ var _ = require('underscore');
var
grpc
=
require
(
'
..
'
);
var
grpc
=
require
(
'
..
'
);
var
examples
=
grpc
.
load
(
__dirname
+
'
/stock.proto
'
).
examples
;
var
examples
=
grpc
.
load
(
__dirname
+
'
/stock.proto
'
).
examples
;
var
StockServer
=
grpc
.
makeServerConstructo
r
([
examples
.
Stock
.
service
]);
var
StockServer
=
grpc
.
buildServe
r
([
examples
.
Stock
.
service
]);
function
getLastTradePrice
(
call
,
callback
)
{
function
getLastTradePrice
(
call
,
callback
)
{
callback
(
null
,
{
price
:
88
});
callback
(
null
,
{
price
:
88
});
...
@@ -80,4 +80,9 @@ var stockServer = new StockServer({
...
@@ -80,4 +80,9 @@ var stockServer = new StockServer({
}
}
});
});
if
(
require
.
main
===
module
)
{
stockServer
.
bind
(
'
0.0.0.0:8080
'
);
stockServer
.
listen
();
}
exports
.
module
=
stockServer
;
exports
.
module
=
stockServer
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment