Async Read Stream Data from buffer
See original GitHub issueHello,
I went through the documentation and examples how to read data from the stream, and I would like to ask a question.
I found out there is the function pop_stream_data_from_stream_buffer and I saw data can be read from the stream with this snippet:
msg = bwsm.pop_stream_data_from_stream_buffer(book_ticker_id)
if msg:
book_ticker(msg)
msg = bwsm.pop_stream_data_from_stream_buffer(user_stream_id)
if msg:
order_status(msg)
time.sleep(0.01)
Would it be possible to read the data in an asynchronous way without doing the “time.sleep” ?
Thank you 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (9 by maintainers)
Top Results From Across the Web
How to use ES8 async/await with streams? - Stack Overflow
async / await only works with promises, not with streams. There are ideas to make an extra stream-like data type that would get...
Read more >Reading streams via async iteration in Node.js - 2ality
In this section, we examine two ways of reading data from a stream asynchronously: via callbacks and via asynchronous iteration.
Read more >Streams and how they fit into Node.js async nature.
Since it acts as a readable and writable stream, internally it maintains two buffers, one for reading date and another one for writing...
Read more >Understanding Streams in Node.js | NodeDev
You can use async iterator when reading from readable streams: ... The read() function reads some data from the internal buffer and returns...
Read more >Stream | Node.js v19.3.0 Documentation
Two reading modes; Three states; Choose one API style; Class: stream.Readable ... Both Writable and Readable streams will store data in an internal...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hoi @brianmori
I was working on a script to use UBWA in combination with asyncio but truth be told, I’m not an expert on asyncio so I am really not sure if it’s best practice. I was playing around with the following code:
That’s the same reason I wrote my async code, haha. But I don’t think that you can use an async function as a callback. However you can use a “normal” function as callback to add the
ingestion
function as a coroutine to the event loop.