summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md18
-rw-r--r--server.py23
2 files changed, 41 insertions, 0 deletions
diff --git a/README.md b/README.md
index 9d43e3f..ea73baa 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,21 @@
# ZeroRPC Test
A simple test to get ZeroRPC for Python running on Heroku.
+
+## Local Dev
+
+### Server
+
+```bash
+$ python server.py
+```
+
+### Client
+```bash
+$ zerorpc -j tcp://localhost:4242 add_42 1
+43
+$ zerorpc tcp://localhost:4242 add_man 'I own a mint-condition Volkswagen Golf'
+"I own a mint-condition Volkswagen Golf, man!"
+$ zerorpc tcp://localhost:4242 boat 'I own a mint-condition Volkswagen Golf, man!'
+"I'm on a boat!"
+```
diff --git a/server.py b/server.py
new file mode 100644
index 0000000..caa08de
--- /dev/null
+++ b/server.py
@@ -0,0 +1,23 @@
+import zerorpc
+
+
+class Cooler(object):
+ def add_man(self, sentence):
+ """ End a sentence with ", man!" to make it sound cooler, and
+ return the result. """
+ return sentence + ", man!"
+
+ def add_42(self, n):
+ """ Add 42 to an integer argument to make it cooler, and return the
+ result. """
+ return n + 42
+
+ def boat(self, sentence):
+ """ Replace a sentence with "I'm on a boat!", and return that,
+ because it's cooler. """
+ return "I'm on a boat!"
+
+
+s = zerorpc.Server(Cooler())
+s.bind("tcp://0.0.0.0:4242")
+s.run()