Noob Question: Differences between httpx and httpx-ws #17
-
So I've been using They have a subscription capability for events. Looking through the httpx docs there is a notion of stream but I don't get the impression that it fully support websocket. So my questions are:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
So, they are complimentary in the sense that they don't serve the same purpose. In your client implementation, you'll probably have two approaches:
data = sui_client.get_transaction("TRANSACTION_ID")
print(data)
with sui_client.listen_events(filter="sender:SENDER_ID") as stream:
while True:
data = stream.receive() # Will block until a message is received
print(data) In the context of a client, I don't really understand what you want to mean by "support multiple websocket connections". IMO, you should provide the required function (like above) to open an event stream with a specific filter. If users of your client wants to listen for several streams at the same time, well, that's up to them to implement this (maybe they'll do multi-threading, or dispatch to a broker, there a lot of solutions for this kind of thing). |
Beta Was this translation helpful? Give feedback.
So, they are complimentary in the sense that they don't serve the same purpose. In your client implementation, you'll probably have two approaches: