MCPcopy Create free account
hub / github.com/FastLED/FastLED / StreamHandle

Class StreamHandle

src/fl/net/http/stream_transport.h:23–49  ·  view source on GitHub ↗

Handle for ASYNC_STREAM calls Provides onData() for intermediate updates, plus then()/catch_() for final result

Source from the content-addressed store, hash-verified

21/// Handle for ASYNC_STREAM calls
22/// Provides onData() for intermediate updates, plus then()/catch_() for final result
23class StreamHandle {
24public:
25 StreamHandle() FL_NOEXCEPT = default;
26
27 /// Register callback for intermediate stream data
28 StreamHandle& onData(fl::function<void(const fl::json&)> cb);
29
30 /// Register callback for final result
31 StreamHandle& then(fl::function<void(const fl::json&)> cb);
32
33 /// Register callback for errors
34 StreamHandle& catch_(fl::function<void(const fl::task::Error&)> cb);
35
36 /// Access the underlying promise
37 fl::task::Promise<fl::json>& promise();
38
39 /// Check if handle is valid
40 bool valid() const;
41
42private:
43 friend class HttpStreamTransport;
44 StreamHandle(fl::task::Promise<fl::json> p,
45 fl::shared_ptr<fl::function<void(const fl::json&)>> updateCb);
46
47 fl::task::Promise<fl::json> mPromise;
48 fl::shared_ptr<fl::function<void(const fl::json&)>> mUpdateCallback;
49};
50
51/// Base class for HTTP streaming transport
52/// Implements RequestSource and ResponseSink for Remote class

Callers 1

rpcStreamMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected