Create example directory and separate client/server.
This commit is contained in:
parent
ce7716463d
commit
9007eacdf3
1
examples/.gitignore
vendored
Normal file
1
examples/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
dub.selections.json
|
1
examples/client/.gitignore
vendored
Normal file
1
examples/client/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
client
|
10
examples/client/dub.json
Normal file
10
examples/client/dub.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "client",
|
||||
"homepage": "https://github.com/trishume/ddbus",
|
||||
"copyright": "Copyright © 2017, Tristan Hume",
|
||||
"authors": ["Tristan Hume"],
|
||||
"targetType": "executable",
|
||||
"dependencies": {
|
||||
"ddbus": {"path": "../../"}
|
||||
}
|
||||
}
|
21
examples/client/source/client.d
Normal file
21
examples/client/source/client.d
Normal file
|
@ -0,0 +1,21 @@
|
|||
import std.stdio;
|
||||
import ddbus;
|
||||
|
||||
void testCall(Connection conn) {
|
||||
for(int i = 0; i < 50; i++) {
|
||||
Message msg = Message("ca.thume.transience","/ca/thume/transience/screensurface",
|
||||
"ca.thume.transience.screensurface","testDot");
|
||||
conn.sendBlocking(msg);
|
||||
}
|
||||
Message msg2 = Message("ca.thume.transience","/ca/thume/transience/screensurface",
|
||||
"ca.thume.transience.screensurface","testPing");
|
||||
Message res = conn.sendWithReplyBlocking(msg2,3000);
|
||||
int result = res.read!int();
|
||||
writeln(result);
|
||||
}
|
||||
|
||||
void main() {
|
||||
Connection conn = connectToBus();
|
||||
testCall(conn);
|
||||
writeln("It worked!");
|
||||
}
|
1
examples/server/.gitignore
vendored
Normal file
1
examples/server/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
server
|
10
examples/server/dub.json
Normal file
10
examples/server/dub.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "server",
|
||||
"homepage": "https://github.com/trishume/ddbus",
|
||||
"copyright": "Copyright © 2017, Tristan Hume",
|
||||
"authors": ["Tristan Hume"],
|
||||
"targetType": "executable",
|
||||
"dependencies": {
|
||||
"ddbus": {"path": "../../"}
|
||||
}
|
||||
}
|
|
@ -1,19 +1,6 @@
|
|||
import std.stdio;
|
||||
import ddbus;
|
||||
|
||||
void testCall(Connection conn) {
|
||||
for(int i = 0; i < 50; i++) {
|
||||
Message msg = Message("ca.thume.transience","/ca/thume/transience/screensurface",
|
||||
"ca.thume.transience.screensurface","testDot");
|
||||
conn.sendBlocking(msg);
|
||||
}
|
||||
Message msg2 = Message("ca.thume.transience","/ca/thume/transience/screensurface",
|
||||
"ca.thume.transience.screensurface","testPing");
|
||||
Message res = conn.sendWithReplyBlocking(msg2,3000);
|
||||
int result = res.read!int();
|
||||
writeln(result);
|
||||
}
|
||||
|
||||
void testServe(Connection conn) {
|
||||
auto router = new MessageRouter();
|
||||
MessagePattern patt = MessagePattern("/root","ca.thume.test","test");
|
|
@ -1,3 +1,5 @@
|
|||
module ddbus;
|
||||
|
||||
public import ddbus.thin;
|
||||
public import ddbus.router;
|
||||
public import ddbus.bus;
|
||||
|
|
Loading…
Reference in a new issue