https://kotlinlang.org logo
#ktor
Title
# ktor
j

Jamal Khan

11/20/2021, 12:30 AM
i have a question regarding KTOR, is there any way to plugin in an engine that implements a non-HTTP protocol? KTOR looks really nice and i'd like it to be able to support a request/response framework that is proprietary.
d

Dominaezzz

11/20/2021, 12:31 AM
Hmm, is this for what I think it's for? 😄
j

Jamal Khan

11/20/2021, 12:32 AM
most likely yes 🙂
h

hfhbd

11/20/2021, 12:32 AM
Sure, "just" create you own engine and put the instance in the
embeddedServer(yourEngine)
. Alternative you could use the classpath resolving to use HOCON files.
j

Jamal Khan

11/20/2021, 12:34 AM
yeah i was raeding through https://ktor.io/docs/custom-engines.html#applicationengine-api but it isn't apparent whether, engines are protocol agnostic?
d

Dominaezzz

11/20/2021, 12:38 AM
I feel like a lot of Ktor is centred around http, once you do any custom protocol like some proprietary application service framework, you lose a lot of the Ktor features.
j

Jamal Khan

11/20/2021, 12:39 AM
yeah that's what i'm trying to figure out, whether or not pipelines are protocol agnostic, if they are that'd be nice
d

Dominaezzz

11/20/2021, 12:44 AM
Ahh it's that bit you care about. Yeah that's agnostic afaik.
In addition to HTTP ktor has websockets so non-http is doable for sure.
h

hfhbd

11/20/2021, 12:47 AM
According to the docs: Some engines can support other connector types, hence not an enum.
So you should be able to implement it
m

Morgan Pittkin

11/20/2021, 11:10 PM
And you can work with just raw sockets as well: https://ktor.io/docs/servers-raw-sockets.html#server
2 Views