You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update readme
* Add ipv6 check in port ping
* Add windows eventloop
* Add windows eventloop
* Change subprocess start checks
* Improve ready markers
* Fix server host in test
* Fix tcp binding for same port
* Disable TCP for windows
* Fix imports in tests
* Fix fixture for windows
* Fix fixture logic
* Start tcp client connections concurrently
* Reduce test poolsize
* disable test
* fix some linting issues
Copy file name to clipboardExpand all lines: README.md
+97-6Lines changed: 97 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@
27
27
28
28
**Features**:
29
29
30
-
* Zero provides **faster communication** (see [benchmarks](https://github.com/Ananto30/zero#benchmarks-)) between the microservices using [zeromq](https://zeromq.org/) under the hood.
30
+
* Zero provides **faster communication** (see [benchmarks](https://github.com/Ananto30/zero#benchmarks-)) between the microservices using [zeromq](https://zeromq.org/)or raw TCP under the hood.
31
31
* Zero uses messages for communication and traditional **client-server** or **request-reply** pattern is supported.
32
32
* Support for both **async** and **sync**.
33
33
* The base server (ZeroServer) **utilizes all cpu cores**.
@@ -126,6 +126,56 @@ pip install zeroapi
126
126
loop.run_until_complete(hello())
127
127
```
128
128
129
+
### TCP client/server
130
+
131
+
* By default Zero uses ZeroMQ for communication. But if you want to use raw TCP, you can use the protocol parameter.
132
+
133
+
```python
134
+
from zero import ZeroServer
135
+
from zero.protocols.tcp import TCPServer
136
+
137
+
app = ZeroServer(port=5559, protocol=TCPServer) # <-- Note the protocol parameter
138
+
139
+
@app.register_rpc
140
+
defecho(msg: str) -> str:
141
+
return msg
142
+
143
+
@app.register_rpc
144
+
asyncdefhello_world() -> str:
145
+
return"hello world"
146
+
147
+
148
+
if__name__=="__main__":
149
+
app.run()
150
+
```
151
+
152
+
* In that case the client should also use TCP protocol.
The return type of the RPC function can be any of the [supported types](https://jcristharif.com/msgspec/supported-types.html). If `return_type` is set in the client `call` method, then the return type will be converted to that type.
*If you want a async client just replace `ZeroClient` with `AsyncZeroClient` in the generated code, and update the methods to be async. (Next version will have async client generation, hopefully 😅)*
326
+
### Async client code generation
327
+
328
+
* To generate async client code, use the `--async` flag.
0 commit comments