Open aleeusgr opened 11 months ago
https://www.youtube.com/@JeremyChone/playlists
create a server that does X and streams them over HTTP in real-time to connected clients. https://github.com/aleeusgr/efected-coto-emmory/blob/4b1bfa6bd827e974333a93b02a375ad9cee40589/src/main.rs#L141-L144 Router is the type for composing handlers and services. https://github.com/aleeusgr/efected-coto-emmory/blob/d61aee230886260c02deb0ca3f89a91745447b16/src/main.rs#L86-L89 Handlers are where your application logic lives and axum applications are built by routing between handlers. https://github.com/aleeusgr/efected-coto-emmory/blob/d61aee230886260c02deb0ca3f89a91745447b16/src/main.rs#L116 A handler is an async function that accepts zero or more “extractors” as arguments and returns something that can be converted into a response. https://github.com/aleeusgr/efected-coto-emmory/blob/d61aee230886260c02deb0ca3f89a91745447b16/src/handlers/my.rs#L10-L19
An extractor is a type that implements FromRequest or FromRequestParts.
- [x] ~~Quick example of axum + async-stream~~ no readme, testing unclear
https://github.com/fasterthanlime/stream-example/blob/main/src/main.rs
- [x] axum server that serves a live stream of its own tracing log to an HTML page
https://github.com/thallada/axum-log-stream/blob/main/src/main.rs
- [x] [stream an image](https://imfeld.dev/writing/process_streaming_uploads_with_axum)
- [x] https://github.com/aleeusgr/efected-coto-emmory/pull/33/commits/8559281eccc962c198f7cd4232211be60f8b0338
- [ ] add Camera Management Module
- [x] 2. Binding TCP Listener:
- [ ] 3. Initializing Camera :
- [x] 4. Main Loop:
The above code enters a main loop, where it continuously listens for incoming client connections and serves them with live video frames.
- [x] 5. Accepting Client Connection
server waits for a client to connect using the `listener.accept()` function. Once a connection is established, it returns a TCP stream (stream) that will be used to communicate with the client.
- [ ] 6. Capturing and Encoding Frame
- [x] 7. Creating Response Header
- [x] 8. Sending Response Header
The response header is written to the client’s stream using the `stream.write_all` function.
- [ ] 9. Inner Loop for Streaming Frames:
- [ ] capture a frame,
- [ ] 10. Encoding and Sending Frames:
the server again captures a frame, encodes it, and stores the encoded data in the buf vector. It then constructs an HTTP response with appropriate content type and content length headers for the image.
- [x] 11. Flushing Stream:
After sending the image data, the server flushes the stream using stream.flush() to ensure that the data is sent immediately to the client.
- [ ] 12. Run: Enter “cargo run”
Details
continuously poll the data source to create a stream of data over the command line. Once you’ve set up that functionality, you’ll integrate new CLI into your company’s wider intelligence gathering system, which requires exposing an HTTP endpoint that provides the most recent performance indicators.
https://www.manning.com/liveproject/advanced-data-streaming-with-async-rust
To implement the video streaming server using Rust and Axum, you would follow these general steps:
a system test is the evidence of application functionality as a whole.