Skip to content

Stream to SSE from another endpoint (upload) #446

Answered by sunli829
AlexMikhalev asked this question in Q&A
Discussion options

You must be logged in to vote

Execute bash script with POST

curl -X 'POST' 'http://localhost:3000/api/exec' -H 'Content-Type: text/plain; charset=utf-8' -d 'ls' -v

Get the outputs with SSE:

curl 'http://localhost:3000/api/output/afdec250-b5a6-42fe-bd37-d14aeadf9cf4' -H 'Content-Type: text/plain; charset=utf-8' -v 

Cargo.toml

[package]
name = "ws_example"
version = "0.1.0"
edition = "2021"

[dependencies]
poem = { version = "1.3.49", features = ["session"] }
poem-openapi = { version = "2.0.21", features = ["swagger-ui", "uuid"] }
tokio = { version = "1.21.2", features = [
    "rt-multi-thread",
    "macros",
    "net",
    "sync",
    "process",
    "io-util",
] }
tokio-stream = { version = "0.1.11", features = ["sync"]…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@AlexMikhalev
Comment options

@AlexMikhalev
Comment options

@sunli829
Comment options

@AlexMikhalev
Comment options

@AlexMikhalev
Comment options

Comment options

You must be logged in to vote
1 reply
@AlexMikhalev
Comment options

Answer selected by AlexMikhalev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants