Hi all,
I'm relatively new to Akka Streams and I hope I get some pointers on how to
use streams to stream the stdout and stderr from a script run on a server
over a websocket to a client. I'm using akka http and I have a websocket
sample and some basic framing - I need a Flow that takes incoming
ByteStrings and sinks them to stdin, and sources from stdout and stderr
which I can multiplex as the outlet from the flow.
def route: Route = path("script") {
get {
handleWebSocketMessages(service)
}
}
val service: Flow[Message, Message, Any] =
WebsocketFrameStage() atop
ProtocolFlow() join
ScriptEngine
Flow[ByteString, ByteString, Any] =
.. tbd
The first incoming string is the script, the subsequent elements are stdin.
The script host writes to stdout and stderr using blocking OutputStream. I
know I can make these into Sources using StreamConverters.asOutputStream()
- but these need to be materialized, but I believe the materialization of
the flow is done by Akka Http.
val outSource = StreamConverters.asOutputStream();
val errSource = StreamConverters.asOutputStream();
scriptContext.setWriter(new OutputStreamWriter(outSource )) <<-- outSource
needs to be materialized
scriptContext.setErrorWriter(new OutputStreamWriter(errSource ))
How would I go about doing this?
Any tips appreciated!
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.