Skip to content

Commit 95de2cf

Browse files
committed
update: readme
1 parent b108c70 commit 95de2cf

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# stallion-python-sdk
2-
Client sdk for Stallion message broker.
1+
# Stallion Python SDK
2+
3+
Client SDK for **Stallion** message broker.
4+
5+
## How to use?
6+
### Client
7+
Create a client:
8+
```python
9+
from client import Client
10+
11+
c = Client(url="localhost:9090")
12+
```
13+
14+
### Publish
15+
```python
16+
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})
17+
```
18+
19+
### Subscribe
20+
```python
21+
def handler(data):
22+
print(data)
23+
24+
c.Subscribe("book", handler)
25+
```
26+
27+
### Unsubscribe
28+
```python
29+
c.Unsubscribe("book")
30+
```

test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ def handler(data):
2323

2424
# publish messages over a topic
2525
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})
26+
27+
# unsubscribe
28+
c.Unsubscribe("book")

0 commit comments

Comments
 (0)