Is there any chance I can write into a stream on a...
# ktor
j
Is there any chance I can write into a stream on a regular HTTP Request? Like a WebSocket, but without the WebSocket-Layer, just the raw Stream. The Docker Engine gives a
Upgrade: tcp
header when starting an exec-Instance without detaching and I want to be. able to write into that stream as stdin. Is it possible to get the ByteWriteChannel of the connection in the .execute { ... }-Block? If not, I could imagine this channel being exposed as a function that requires you to OptIn.
Copy code
client.socket.preparePost("/exec/$execId/start") {
    contentType(ContentType.Application.Json)
    setBody(StartExecInstanceResponse(detach = false))
}.execute { response ->
    response.rawInput // would return the ByteWriteChannel for this request
}
a
Do you mean to access the underlying write channel used for communicating TCP/IP?
j
Yes, some way for the engine to provide access to the internal streams. I don't think that it'll work with the Android-Engine for example, but in my case I am using CIO which has the raw streams somewhere in the internals.
a
Unfortunately, such low-level implementation details are not exposed.