https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ktor
  • s

    Samuel Michael

    01/30/2020, 11:41 PM
    I could see how this might get a little confusing for a deeply nested object
    t
    m
    • 3
    • 3
  • a

    anthony castillo

    01/31/2020, 2:43 AM
    hi guys. has anyone tried to use log4j threadcontext with ktor?
    c
    • 2
    • 2
  • o

    Ovsyannikov Alexey

    01/31/2020, 6:57 AM
    Hello everybody! Today I have tried to resolve dependency
    io.ktor:ktor-client-encoding:1.3.0
    in my java-only project, but I got error. After this I have used
    io.ktor:ktor-client-encoding-jvm:1.3.0
    and it was successfully resolved. Is it known issue? In the jcenter you have redundant jars in package io/ktor/ktor-client-encoding/1.3.0 which, as I understand, must not be included in case if package is multiplatform-oriented
    e
    • 2
    • 4
  • e

    eirikb

    01/31/2020, 11:24 AM
    Is it possible to disable Ktor client keep-alive?
    e
    c
    • 3
    • 3
  • e

    Efe

    01/31/2020, 9:35 PM
    hi all, I'm really new on ktor. trying to use heroku. I am able to run the sample helloworld project locally. the problem is I'm getting the following error while deploying the project to heroku;
    bash: build/install/myproject/bin/myproject: No such file or directory
    I have the following line in my Procfile
    web: build/install/myproject/bin/myproject
    I am able to see this file in my ide. what should I use for my Procfile? Any guess would be appreciated. Thanks
    c
    • 2
    • 2
  • c

    clhols

    02/01/2020, 2:05 PM
    The Kotlin Blog mentions that you can configure the Ios HTTP engine like this:
    HttpClient(Ios) {
    engine {
    configureSession {
    networkServiceType = NSURLNetworkServiceTypeBackground
    }
    }
    }
    But when doing that, I get the follow compile error: Unresolved reference: NSURLNetworkServiceTypeBackground I am using 1.3.0.
    • 1
    • 1
  • v

    Vincent Chen

    02/03/2020, 9:12 AM
    Hi , My Kotlin-Native Project use androidNativeArm64/32/x64/x86 which implementation can i use?? (i got error with below)
    implementation("io.ktor:ktor-client-android:$ktor_version")
    implementation("io.ktor:ktor-client-core:$ktor_version")
    implementation("io.ktor:ktor-client-curl:$ktor_version")
    ....
    I need to use HttpClient() Thanks
    c
    d
    • 3
    • 2
  • t

    Trond Tunheim

    02/03/2020, 10:20 AM
    Is there a way to trust/ignore selfsigned/internal SSL certificates in Ktor for iOS ? https://stackoverflow.com/questions/60005195/ktor-client-ios-and-self-signed-certificate
    • 1
    • 1
  • a

    Alejandro Rios

    02/04/2020, 4:49 AM
    Hello everybody..., i'm working in a presentation of Ktor for an upcoming Kotlinconf global event (just the basics of ktor), and i was wondering, does anyone knows the meaning of the word Ktor and why JetBrains name his Web Framework like that?
    h
    • 2
    • 2
  • f

    Felistas Ngumi

    02/04/2020, 10:39 AM
    Hi, I'm new to Kotlin and Ktor and i'd like this basic function to run but I can't find where the issue is:
    package com.example
    
    import io.ktor.server.engine.embeddedServer
    import io.ktor.server.netty.Netty
    import io.ktor.routing.*
    
    fun main() {
        embeddedServer(Netty, port = 8080){ }.start()
        routing {
            get("/") {
                call.respondText("Hello, world!", ContentType.Text.Html)
            }
        }
    }
    The issue i'm getting is, the routing package cannot be imported. Any assistance will be greatly appreciated.
    m
    • 2
    • 2
  • n

    nrobi

    02/04/2020, 11:40 AM
    Hey I’m using
    kotlinx-serialization
    with
    ktor
    however I’m receiving a
    java.lang.NoClassDefFoundError
    with
    call.receive<MyModel>
    . Any clue what could be wrong with the setup?
    l
    • 2
    • 4
  • b

    bitkid

    02/04/2020, 12:43 PM
    how much overhead would you think that chunked gzip encoding creates? factor 3 sounds realistic? that's what i am experiencing at least 🙂
    s
    • 2
    • 3
  • n

    Nikky

    02/04/2020, 12:54 PM
    is anyone else getting broken javascript in from the webpack bundle when using ktor 1.3.0 ?
    b
    • 2
    • 2
  • t

    Timur Atakishiev

    02/04/2020, 3:40 PM
    Hi guys, is it any validation library in kotlin, like @NotBlank or @Size?
    m
    c
    • 3
    • 2
  • e

    enleur

    02/04/2020, 5:40 PM
    is CIO client engine still experimental?
    r
    • 2
    • 1
  • d

    David Gethers

    02/04/2020, 11:56 PM
    Hello everyone! I’m having an issue with Ktor de-serializing json in a post request. I’m using
    kotlinx.serialization
    and the exception occurs with
    call.receive<MyMode>
    . I’m curious if it a similar issue is the same as @nrobi. I don’t get the
    java.lang.NoClassDefFoundError
    but I do get
    io.ktor.features.CannotTransformContentToTypeException: Cannot transform this request's content to
    . I followed the instructions in https://ktor.io/servers/features/content-negotiation/serialization-converter.html and https://ktor.io/servers/calls/requests.html. I have the correct grade entry in my build.gradle file:
    implementation "io.ktor:ktor-serialization:$ktor_version"
    I install the ContentNegotiator:
    fun Application.module() {
        install(ContentNegotiation) {
            serialization(
                contentType = ContentType.Application.Json,
                json = Json(DefaultJsonConfiguration.copy(prettyPrint = true))
            )
        }
    
        val dao = DAOFacadeDatabase(Database.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", driver = "org.h2.Driver"))
        val server = embeddedServer(Netty, port = 8080) {
    I have my simple data class:
    data class UrlMap(val id: String, val url: String, val userId: String)
    The exception is thrown here:
    val receive = call.receive<UrlMap>()
    I follow multiple examples on website and the official Ktor documentation and I can’t get it to work. I’m using Ktor 1.3.0 with Kotlin 1.3.61. Any help would be greatly appreciated
    👍 1
    t
    n
    +4
    • 7
    • 22
  • t

    tylerwilson

    02/05/2020, 10:10 PM
    I am working on uploading via Ktor MutliPartFormDataContent an image from MP module (File on Java and NSData on iOS). I see an Input/AbstractInput interface that appears needed to wrap the native types so Ktor can pull in the requisite data. I don’t suppose anybody has an example of implementing AbstractInput? I am trying, but it does not seem to advance past the first block. Thank you!
    e
    c
    • 3
    • 6
  • l

    louiscad

    02/06/2020, 10:25 AM
    I have the same question for the
    ktor-http
    artifact. Not referenced in https://ktor.io/quickstart/artifacts.html either, and no README about it on GitHub.
    e
    • 2
    • 2
  • m

    muliyul

    02/06/2020, 10:42 AM
    Is there a support for HikariCP's setHealthCheckRegistry? I'm trying this:
    Jdbi.create(HikariDataSource(HikariConfig().apply {
    			username = config.property("db.username").getString()
    			password = config.property("db.password").getString()
    			jdbcUrl = config.property("db.jdbcUrl").getString()
    
    			application.featureOrNull(DropwizardMetrics)?.registry?.also {
    				<http://application.log.info|application.log.info>("Dropwizard metrics feature detected. Registering HikariCP metrics.")
    				metricRegistry = it
    				healthCheckRegistry = it
    			}
    		}
    but getting an error:
    java.lang.NoClassDefFoundError: com/codahale/metrics/health/HealthCheckRegistry
    at com.zaxxer.hikari.HikariConfig.setHealthCheckRegistry(HikariConfig.java:697)
    c
    • 2
    • 6
  • e

    eirikb

    02/06/2020, 2:24 PM
    I'm looking for examples of how to combine Ktor WebSocket client with Asynchronous Flow. I have a pub/sub-like setup where I send a message to server in order to subscribe for values, but I'm completely lost on how to set this up. I can share what I have so far, but it's quite bad. I doesn't have to be with Flow, but I figured it would fit quite well here.
    c
    • 2
    • 12
  • s

    Slackbot

    02/06/2020, 3:59 PM
    This message was deleted.
    k
    • 2
    • 1
  • c

    Clyde

    02/07/2020, 1:14 AM
    I'm getting `ResponseAlreadySentException`s when using a redirect. Stack trace:
    io.ktor.server.engine.BaseApplicationResponse$ResponseAlreadySentException: Response has already been sent
    at io.ktor.server.engine.BaseApplicationResponse.commitHeaders (BaseApplicationResponse.kt:44)
    at io.ktor.server.engine.BaseApplicationResponse.respondOutgoingContent$suspendImpl (BaseApplicationResponse.kt:108)
    at io.ktor.server.engine.BaseApplicationResponse.respondOutgoingContent (BaseApplicationResponse.kt)
    The code generating the response is:
    call.respondRedirect(signedUrl)
    where
    signedUrl
    is a string with a URL. The redirect works - the client gets the correct result and redirects to the new path. Just wondering why there is an exception.
    r
    • 2
    • 2
  • m

    Maurice Wingbermuhle

    02/07/2020, 12:33 PM
    When I'm trying to download a "larger" file (355k) with HttpClient, it seems that it does not let me read more than 4096 bytes. What I could I be doing wrong? I am also not seeing the response logging in Logcat, just the request
    e
    e
    • 3
    • 53
  • j

    Jordan Terrell

    02/07/2020, 2:01 PM
    Hello everyone! I'd like to modify an incoming request early in the pipeline before other features have an opportunity to see the request. I've looked through the samples and most seem to focus on modifying the response, not the request. Can anyone point me to an example of modifying an incoming request or provide some suggestions? It would be much appreciated!
    e
    • 2
    • 1
  • b

    Brindasanth

    02/07/2020, 11:30 PM
    Hi Team, Is there any default distributed lock implementation in ktor ?
    m
    • 2
    • 3
  • r

    Rodrigo Silva

    02/08/2020, 9:38 PM
    Hello all. How do I call a suspend function in Application.kt? I have a suspend fun and when I call it, an error appears forcing to change the main function to suspend. And if I do that, I can't start the application.
    a
    • 2
    • 5
  • c

    CLOVIS

    02/09/2020, 7:15 PM
    Also, do you think it is better practice to call
    HttpClient()
    in the common code, or to
    expect
    the client from each platform to have more granular settings (but maybe code duplication as well?)
    r
    • 2
    • 3
  • j

    Jordan Terrell

    02/10/2020, 3:19 PM
    Repost: I'd like to modify an incoming request early in the pipeline before other features have an opportunity to see the request. I've looked through the samples and most seem to focus on modifying the response, not the request. Can anyone point me to an example of modifying an incoming request or provide some suggestions? It would be much appreciated!
    😢 1
    z
    • 2
    • 3
  • p

    pavel

    02/10/2020, 9:47 PM
    That error would typically be coming from the server you are calling. It is completely within it’s rights to return a 411 response
    ➕ 1
    r
    • 2
    • 9
  • t

    Tony

    02/11/2020, 8:16 PM
    Hi. Is KTOR 1.3.1 out yet?
    c
    l
    • 3
    • 11
Powered by Linen
Title
t

Tony

02/11/2020, 8:16 PM
Hi. Is KTOR 1.3.1 out yet?
c

cy

02/11/2020, 8:17 PM
We can’t publish it to maven central
t

Tony

02/11/2020, 8:17 PM
Oh? Is there something wrong?
c

cy

02/11/2020, 8:18 PM
We are doing it via bintray, but it doesn’t work well last months
You may use jcenter to get 1.3.1 if required
t

Tony

02/11/2020, 8:19 PM
Oh no! =[
Is jcenter the long term solution or short term?
c

cy

02/11/2020, 8:19 PM
Or ktor repo directly
We are not planning to migrate from bintray yet, we hope they’ll fix it
We are experiencing that problem every release 😞
t

Tony

02/11/2020, 8:22 PM
Thanks Sergey. 😞 I am sorry to hear about release problems! I hope it gets better soon! 🙂
l

louiscad

02/17/2020, 3:12 PM
What is the issue regarding maven central exactly? I'm interested as a KMPP library developer that currently only publishes on bintray & jcenter and had maven central sync in mind
👀 1
View count: 3