ktorio / ktor

Framework for quickly creating connected applications in Kotlin with minimal effort
https://ktor.io
Apache License 2.0
12.76k stars 1.04k forks source link

HTTP Upgrade Support #1479

Closed icode closed 4 years ago

icode commented 4 years ago

I can't found HTTP Upgrade Support API. https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism

It's very useful, like for gRPC, custom protocol

e5l commented 4 years ago

Hi @icode, thanks for the report. Do you have an idea about API for that feature?

icode commented 4 years ago

Like servlet HttpUpgradeHandler, netty https://netty.io/4.1/api/io/netty/handler/codec/http2/CleartextHttp2ServerUpgradeHandler.html .

icode commented 4 years ago

Maybe we can get pipeline involved? Add HttpUpgrade PipelinePhase?

e5l commented 4 years ago

It looks like we have a special OutgoingContent for the upgrade: https://api.ktor.io/1.2.6/io.ktor.http.content/-outgoing-content/-protocol-upgrade/index.html

icode commented 4 years ago

I found Websocket use this api, it's same like HttpUpgrade

icode commented 4 years ago

Can you write him into the document?

e5l commented 4 years ago

@cy6erGn0m