Hey folks, question regarding feasibility. I'm pla...
# ktor
e
Hey folks, question regarding feasibility. I'm planning on shipping a prototype of an MCP server (using kotlin-sdk) that should work under Node.js/Electron, most probably through WebSocket or standard i/o. I'd need to use an embedded server, and start it through a custom function at a custom time. Is this scenario supported for Ktor under K/JS? K/Wasm could be an alternative, but I currently prefer using JS.
a
What do you mean by starting the server through a custom function at a custom time?
e
@Aleksei Tirman [JB] I'd like to export the whole thing as a library, consumable from TypeScript. I can then start the server with a function call.
a
The CIO engine is implemented for the NodeJS target and supports WebSockets. I think you can use JsExport to export a function that will start the server.
e
So basically
Copy code
@JsExport
fun myEntryPoint() {
  val server = embeddedServer(...)
}
Correct?
a
This should work
e
Thank you! I'll give it ago. I have seen posix and JS/Wasm do not support some actualizations (e.g. multipart data) but that should not matter I believe.