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
apollo-kotlin
  • j

    Jabez Magomere

    09/29/2020, 9:38 AM
    Hey Everyone, we heavily rely on GraphQL at our work place to support queries on our different mobile apps. One of the issues we’ve been facing is high data consumption as a result of the queries we are performing, i’m looking into graphQL compression with gzip, is this supported on the android client side, and how can i implement it?
    m
    • 2
    • 4
  • v

    Vitaliy Kondratiev

    11/20/2020, 1:05 AM
    Hey guys. I have a strange problem that I need an opinion on. We have an active subscription and a mutation that returns the same data. Problem is that the data over the subscription comes back faster than the data over the mutation and is in a more recent state. But we cache the last data that we get from the mutation resulting in having a wrong state. I'm wondering if there is a way around this other than just simply ignoring all data from the mutation. Thanks in advance
    m
    • 2
    • 23
  • a

    Aleksandr Ivanov

    11/25/2020, 9:25 AM
    Hello, we are using apollo library on our mobile clients (ios/android). We want to create a mutation which contains dynamic set of another mutations. But we haven’t find the right way to do that. Example query:
    mutation offlineSync {
      s1: createDeliveryShift(input: {
        id: "71ea006c-2a4d-476a-9bcc-78c43baa7bb7"
        data: {
          id: "71ea006c-2a4d-476a-9bcc-78c43baa7bb7"
        }
        registeredAt: "2020-11-05T14:11:00.000Z"
      }) {
        id
      }
      s2: startDeliveryShift(input: {
        id: "2cd03c01-c684-41f1-b1a0-aac285b29ba7"
        data: {
          id: "71ea006c-2a4d-476a-9bcc-78c43baa7bb7"
          startedAt: "2020-11-05T14:11:00.000Z"
        }
        registeredAt: "2020-11-05T14:11:00.000Z"
      }) {
        id
      }
    }
    amount of mutation is dynamic. in the example there is only two mutations s1,s2, but amount and type of mutations could be different. Is it possible to do that wit apollo client library?
    m
    • 2
    • 9
  • w

    wasyl

    11/26/2020, 10:15 PM
    Am I doing something wrong when checking out the project locally? I recall having problems with unresolved references back couple of months ago, and now I imported fresh project and have the same issue 😕
    m
    • 2
    • 11
  • a

    Attila Blenesi

    12/09/2020, 12:10 AM
    👋 Nice to see a channel here on Kotlinlang ❤️ I have been trying to setup
    downloadApolloSchema
    task in kts for a multi module project, without success.
    apollo {
        generateKotlinModels.set(true)
        customTypeMapping.set(mapOf("Date" to "me.sphere.appcore.utils.EpochSeconds"))
    
        service("Service") {
            sourceFolder.set("commonMain")
            schemaPath.set("com/example/schema.json")
            introspection {
                endpointUrl.set("<https://api.example.com/graphql>")
                sourceSetName.set("commonMain") <-- This is same as sourceFolder? Do we need to declare it 2x
            }
        }
    }
    I'm getting:
    Execution failed for task ':appcore-apollo:downloadApolloSchema'.
    > ApolloGraphQL: cannot determine where to save the schema. Specify --schema or --service
    In an Android project specifying only
    schemaPath
    , introspection with
    endpointUrl
    works without any issues.
    ❤️ 1
    m
    • 2
    • 4
  • o

    Oleksii Yerastov

    12/09/2020, 8:55 AM
    Hi there! Can somebody tell me what can cause an issue when I receive unknown
    enum
    value from API and leads to error response? As I can see apollo generates
    safeValueOf(rawValue: String)
    method in enum class alongside with
    /**
     * Auto generated constant for unknown enum values
     */
    UNKNOWN__("UNKNOWN__");
    value for unknown enums. Also there is usage of this method in
    operator fun invoke(reader: ResponseReader)
    for entity that contains this enum. Do I need to explicitly enable something to make this work so I apollo can parse unknown enum values to UNKNOWN?
    m
    • 2
    • 21
  • w

    wasyl

    12/11/2020, 5:13 PM
    Hi! We’re observing some strange behaviour when using
    cache_only
    fetch strategy, namely our Flow with that strategy fails with a network exception. Is it possible that a query with cache_only fetch strategy makes, or triggers (by refetching some previous query), a network call?
    m
    • 2
    • 38
  • w

    wasyl

    12/15/2020, 6:43 PM
    Is there any documentation around
    CacheKeyResolver
    and
    fromFieldRecordSet
    and
    fromFieldArguments
    methods?
    fromFieldRecordSet
    seems like it asks for cache key for every object (non-scalar) in the response? But what does
    fromFieldArguments
    do?
    m
    • 2
    • 8
  • w

    wasyl

    01/08/2021, 2:57 PM
    Are there any tricks to optimizing loading from SQL cache? In debug loading from the cache is very slow (~2 seconds for a list of 20 objects). Faster in release of course, but I have a feeling something can be done. Do you see visible delays when loading data from cache?
    t
    m
    • 3
    • 12
  • m

    maxgdn

    01/12/2021, 7:40 PM
    I am attempting to take some data from the apolloStore cache with read(Query(id)).execute() modify a field on the returned query then update with writeAndPublish() back into the cache. However the generated types have read-only val tacked on from the generate gradle task provided by apollo. Is there a simple way around this?
    m
    • 2
    • 2
  • a

    am414

    01/17/2021, 3:27 PM
    hello everyone i'm using schema.json from https://apollo-fullstack-tutorial.herokuapp.com/graphql and i alwyes get this error
    Failed to locate schema root node `__schema`
    also if i put the whole json object inside these
    {
      "data": {
        "__schema": {here}
      }
    
    }
    i got another error
    Required value 'types_' (JSON name 'types') missing at $.data.__schema
    we solve this error in our server but is I miss something ? or they need to update the website ?
    m
    • 2
    • 5
  • w

    wasyl

    01/26/2021, 2:14 PM
    FYI I opened https://github.com/apollographql/apollo-android/issues/2899 which is super weird, and we spent better part of recent days chasing it down. I’m available for clarification if needed, esp. if it’s non-reproducible for Apollo folks
    👀 1
    m
    • 2
    • 38
  • w

    wasyl

    02/02/2021, 2:30 PM
    Quick question about Apollo-Android 3.x, is there any timeline for alpha? Of course I understand that there’s no release date, I’m just looking for an answer like “hopefully somewhere mid-year”, “next year” or “we honestly don’t know, we’ll release when it’s ready” 🙂
    m
    • 2
    • 10
  • a

    Aleksandr Ivanov

    02/10/2021, 5:55 AM
    Hi there. 👋 We are using apollo multiplatform library in our internal library and decided to publish it to our internal repository. But by some reason we got an exception that apollo is not found during compiling metadata for publishing. When I’m bulding android or ios locally with this multiplatform module - everything works fine. Failed task is “compileIosMainKotlinMetadata”.
    > Task :drivers-app-api:compileIosMainKotlinMetadata FAILED
    e: /Users/alexander.ivanov/Development/pmob-sdrv-graphql-api-tool/sources/drivers-app-api/src/iosMain/kotlin/com/arrival/adp/drivers/app/api/DictionariesApi.kt: (3, 12): Unresolved reference: apollographql
    e: /Users/alexander.ivanov/Development/pmob-sdrv-graphql-api-tool/sources/drivers-app-api/src/iosMain/kotlin/com/arrival/adp/drivers/app/api/DictionariesApi.kt: (10, 2): Unresolved reference: ApolloExperimental
    e: /Users/alexander.ivanov/Development/pmob-sdrv-graphql-api-tool/sources/drivers-app-api/src/iosMain/kotlin/com/arrival/adp/drivers/app/api/DriverScheduleApi.kt: (3, 12): Unresolved reference: apollographql
    e: /Users/alexander.ivanov/Development/pmob-sdrv-graphql-api-tool/sources/drivers-app-api/src/iosMain/kotlin/com/arrival/adp/drivers/app/api/DriverScheduleApi.kt: (11, 2): Unresolved reference: ApolloExperimental
    e: /Users/alexander.ivanov/Development/pmob-sdrv-graphql-api-tool/sources/drivers-app-api/src/iosMain/kotlin/com/arrival/adp/drivers/app/api/DriversApi.kt: (3, 12):
    Any ideas of a reason for that behavior?
    m
    • 2
    • 29
  • e

    Eduard Boloș

    03/01/2021, 5:22 PM
    Hello! Any reason why
    NormalizedCache#merge(com.apollographql.apollo.cache.normalized.Record, com.apollographql.apollo.cache.CacheHeaders)
    (https://github.com/apollographql/apollo-android/blob/bd707bbcb14741a3d2176ae93007bc42d080d878/apollo-normalized-cache-api/src/commonMain/kotlin/com/apollographql/apollo/cache/normalized/NormalizedCache.kt#L58) is not returning
    Set<String>
    instead of
    Set<String?>
    . Both
    NormalizedCache#merge(com.apollographql.apollo.cache.normalized.Record, com.apollographql.apollo.cache.CacheHeaders)
    and
    NormalizedCache#merge(com.apollographql.apollo.cache.normalized.Record, com.apollographql.apollo.cache.CacheHeaders)
    already return non-nullable String sets, I find the difference a bit annoying, and it forces me to make a cast to
    Set<String>
    in our codebase xD Also, technically, nothing is impeding the return type to be a set of non-nullable strings. I am happy open a PR that changes the return type, if you think that it makes sense.
    m
    • 2
    • 9
  • a

    André Thiele

    03/20/2021, 4:02 PM
    Whats the recommended way to include an HttpLogging Interceptor? I dont want an explicit dependency on the interceptor which messes with the other versions from Apollo itself? Thanks in advance
    m
    w
    • 3
    • 16
  • a

    André Thiele

    03/21/2021, 2:52 PM
    Whats the recommended way to map generated types to domain objects?
    t
    w
    • 3
    • 14
  • n

    Neal Sanche

    03/22/2021, 10:01 PM
    Ran into a strange problem. I'm doing some cutting edge Android development with Kotlin Multiplatform as a target for some GraphQL stuff. I'm simply trying to download the schema using the
    downloadApolloSchema
    gradle target, and wasn't able to. I've configured my multiplatform project exactly as the documentation says. But where this project differs is in the top level build gradle file which has:
    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
            classpath("com.android.tools.build:gradle:7.0.0-alpha11")
    I found that if I use android tools >
    7.0.0-alpha06
    I get the following error when downloading a schema through gradle:
    * What went wrong:
    Execution failed for task ':shared:downloadApolloSchema'.
    > Companion
    If I
    --stacktrace
    that, a bit more information is present:
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class okhttp3.internal.Util
            at okhttp3.RequestBody$Companion.create(RequestBody.kt:145)
            at okhttp3.RequestBody$Companion.create$default(RequestBody.kt:143)
            at com.apollographql.apollo.gradle.internal.SchemaHelper.executeQuery$apollo_gradle_plugin(SchemaHelper.kt:39)
    Which doesn't make a lot of sense. Why would things change in
    7.0.0-alpha07
    that would cause this sort of issue? Any ideas?
    w
    m
    • 3
    • 34
  • v

    Vyshas

    03/23/2021, 9:31 PM
    Hi all, are there examples of displaying data using cursor based pagination but also have subscription for each page as existing data can be updated in real-time and new data could be added at the top of the list?Is this even possible ?
    w
    • 2
    • 2
  • c

    clark

    03/27/2021, 4:57 PM
    Has anyone devised a good way to add a dynamic auth header to a multiplatform apollo client? Seems like the recommended OkHttp interceptor would only work on Android, right?
    m
    r
    p
    • 4
    • 42
  • c

    clark

    04/01/2021, 3:09 AM
    I get a weird exception when I try to use a multiplatform apollo client in iOS. The error I get is not very helpful:
    KotlinException=kotlin.AssertionError: Assertion failed
    I've seen a couple sample projects, like the one from Apollo's github, and it has an iOS specific implementation of the repository that does some work with the coroutines scope. Is that what might be causing my issue? Anyone else using apollo client in a multiplatform project in iOS and able to successfully make queries and mutations?
    m
    • 2
    • 7
  • c

    clark

    04/01/2021, 2:10 PM
    Anyone found any elegant ways to handle the main thread precondition for multiplatform apollo on iOS? I would prefer to not have to create a wrapper class specifically for iOS for each of my repositories.
    r
    • 2
    • 5
  • s

    Samuel Michael

    04/06/2021, 2:31 AM
    Hey working with Android client and trying to figure out if we are able to import graphql fragments into multiple queries? I saw in the docs somewhere that webpack allows you to do something like
    #import "./MyFragment"
    that but so far no example in an Android context. Currently we are redefining the same huge fragments in multiple queries and would like to be able to extract all those into several separate fragment files and DRY up the main queries
    w
    • 2
    • 8
  • e

    Eduard Boloș

    04/12/2021, 10:44 AM
    Hi, all! Probably this is not 100% Apollo specific, but I guess that it's the most appropriate audience to ask this question. TL;DR: Is there a way with static analysis to tell which fields are used, in order to avoid breaking GQL changes on the backend? Long version: In our project, it happened a couple of times this year that someone (one time it was me 😄) made changes to the backend that broke our Android clients. We already have a check in place on the CI that should stop us from introducing breaking changes in the GQL schema (when compared with the latest existing schema), but this check can be overridden, as sometimes there is a legitimate reason why you want to introduce that breaking change (for instance, there is no client using the fields you are removing/changing, and you want to make the API better). The problem is that sometimes people are not aware that fields that they are removing/changing in a non-backwards compatible way are actually being in-use, thus breaking some versions of the app. What I am curious to find from you is if you are using or you are aware of some static analysis tooling that can tell you what fields are used in the queries and mutations in the application's
    *.graphql
    files and that would raise an error if someone would try to introduce a breaking change in the GQL schema based on the information of the used fields. If relevant, we are using Apollo-Android on the client-side, Graphene-Python on the backend, and everything is in a monorepo.
    w
    m
    +2
    • 5
    • 8
  • a

    andylamax

    04/25/2021, 10:53 AM
    Sorry guys, I was hoping if someone can point me to a multiplatform sample with an android, js and jvm targets. Looking at the github repo, the pnly multiplatform artifact I see is
    apollo-api
    . Help please
    t
    • 2
    • 4
  • s

    Samuel Michael

    04/26/2021, 3:45 PM
    Curious if anyone has gotten this xcode plugin to work: https://github.com/apollographql/xcode-graphql ?
    e
    • 2
    • 6
  • s

    Samuel Michael

    05/01/2021, 5:09 AM
    Trying to add support for GraphQL Query in multiline Kotlin string template to JS GraphQL plugin available thru Jetbrains Ide's. Getting a little lost in adapting the code which parses javaScript string template example to Kotlin or Unified Abstract Tree for Jvm, anyone familiar with an example of a library that can accomplish this? Something like https://github.com/apollographql/graphql-tag but for kotlin. I see tons of DSL builder implementations but haven't found the regular query embedded in string. E.g. const val query = """ query (...) {...} """
    m
    • 2
    • 8
  • d

    Doug Chappelle

    05/03/2021, 2:21 PM
    @mbonnin does the tutorial using 3.0.0-dev2 https://github.com/apollographql/apollo-android-tutorial/tree/3.0.0. use websockets for mutations and queries?
    m
    • 2
    • 94
  • c

    clark

    05/04/2021, 2:06 AM
    Am I missing something or do I have to call the
    .toInput()
    method on each parameter I pass to an Input object type?
    c
    m
    • 3
    • 9
  • n

    Neal Sanche

    05/04/2021, 11:40 PM
    I've been trying to consume a subscription in Kotlin Multiplatform and finding that I often have many missing elements in my flow. The code I'm using is in the thread.
    m
    • 2
    • 31
Powered by Linen
Title
n

Neal Sanche

05/04/2021, 11:40 PM
I've been trying to consume a subscription in Kotlin Multiplatform and finding that I often have many missing elements in my flow. The code I'm using is in the thread.
Graph is just a poor-man's dependency graph, where we set up the GraphQL subscription client.
Untitled
I've set up code like this for the creation of the ApolloClient for the subscription handling. This connects, and does get one or two elements... But if the elements come in too fast, it seems I don't get them all. When the server delays sending, all of the elements do come in.
Untitled
What am I missing? Am I doing it wrong?
m

mbonnin

05/05/2021, 8:13 AM
That's interesting. Sounds like a
CONFLATED
channel somewhere... Do you have a rough idea of the delay that makes everything work again? Are we talking milliseconds or seconds?
n

Neal Sanche

05/05/2021, 2:32 PM
More than 100ms and works pretty reliably around 1s. I have a little time to play with this today, but then I have to move on.
m

mbonnin

05/05/2021, 2:35 PM
Do you mind opening an issue with your code in the repo (pseudo code work too)? Make sure we can track this?
n

Neal Sanche

05/05/2021, 2:37 PM
I don't mind at all. Since the GraphQL playground seems to be able to get all of the data, I am going to focus on the KMP side and see where I've gone wrong. The server side is using graphql-kotlin, and the code I used for that is really small.
🙏 1
❤️ 1
m

mbonnin

05/05/2021, 2:47 PM
Also quick question, is this JVM, native or both?
n

Neal Sanche

05/05/2021, 2:48 PM
The app will be iOS and Android, so both.
I have only tested on Android so far.
👍 1
Okay, wrote: https://github.com/apollographql/apollo-android/issues/3095 Let me know if you want more information inside that report, @mbonnin
m

mbonnin

05/05/2021, 3:03 PM
Thanks, will look into it!
graphql-ws
is getting some attention lately, I know @Doug Chappelle has been looking into it too a couple of threads just above this one so looks like there might be something to do there
👍 1
Alright, that'd be the
CONFLATED
I guess: https://github.com/apollographql/apollo-android/blob/818ff720fe982132e9e0d5bccd20e[…]llographql/apollo/network/ws/ApolloWebSocketNetworkTransport.kt
n

Neal Sanche

05/05/2021, 4:53 PM
Funny I was just looking at exactly that line.
m

mbonnin

05/05/2021, 4:53 PM
🙂
Not sure there is a reason for this, I guess we should make it configurable somehow, with the defaultcertainly to not drop items
n

Neal Sanche

05/05/2021, 4:55 PM
I'll see if I can get set up to experiment with the different options on that webSocketConnection.broadcast() function...
m

mbonnin

05/05/2021, 4:56 PM
These days,
SharedFlow
might be an option too, I think it didn't exist at the time
n

Neal Sanche

05/05/2021, 4:56 PM
That's true.
m

mbonnin

05/05/2021, 5:02 PM
Oh well, there's more to it as the producer gets called from a okhttp non-suspending callback: https://github.com/apollographql/apollo-android/blob/23e78fc09452e17ffe8d5da9a03f7[…]n/kotlin/com/apollographql/apollo/network/ws/ApolloWebSocket.kt
Buffering will work to a certain extent but proper backpressure handling will require more work
n

Neal Sanche

05/05/2021, 5:18 PM
I've cloned the repo, but not sure the easiest way to make small code changes, publish to my local maven repo and try it in my code?
m

mbonnin

05/05/2021, 5:33 PM
Yep, publishToMavenLocal works well
You can also include the build but tbh that might take longer in gradle sync compared to maven local
n

Neal Sanche

05/05/2021, 6:20 PM
Okay,
publishToMavenLocal
works. Just doing that and testing a few things out here.
So, making ApolloWebSocketNetworkTransport.kt:180 read:
private val messageChannel: BroadcastChannel<ByteString> = webSocketConnection.broadcast(Channel.BUFFERED)
works the way I'd expect it to. I get all of the data items delivered.
👍 1
m

mbonnin

05/05/2021, 6:48 PM
Nice! Want to submit a PR to make this a parameter of
ApolloWebSocketNetworkTransport
? We can figure out the backpressure stuff later
n

Neal Sanche

05/05/2021, 7:09 PM
Sure, will give that a shot.
Okay, I've made a PR: https://github.com/apollographql/apollo-android/pull/3096 and do let me know in the PR if you'd prefer a different implementation. I simply went for minimal changes, and defaults to the current value.
👍 1
m

mbonnin

05/05/2021, 8:09 PM
Looks good to me, thank you so much for the contribution 😊 !
n

Neal Sanche

05/05/2021, 8:12 PM
You're welcome. Looking forward to using it to finish this feature I'm working on. I'll keep my eye out for when it gets into the repo. Thanks for your help with it!
👍 1
View count: 17