Skip to content

Commit 94fc39b

Browse files
committed
Adjust readme
1 parent 7b086f3 commit 94fc39b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ from jsonrpcserver import dispatch, method, Success
1818
def ping():
1919
return Success("pong")
2020

21+
if __name__ == "__main__":
22+
serve()
23+
```
24+
25+
Alternatively, use `dispatch`:
26+
```python
2127
response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
22-
# '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
28+
# => '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
2329
```
2430

2531
Full documentation is at [jsonrpcserver.com](https://www.jsonrpcserver.com/).

0 commit comments

Comments
 (0)