Skip to content

Latest version doesn't connect to the server properly [4.1.0] #87

Description

@rubenquadros12

Hi,

I'm using version 4.1.0 of the library.

I'm calling eventsource.start() method to connect to the server.
I see that the library internally calls call.execute()

This call.execute() doesn't return anything and no code after this line gets executed.
I have debugged the code, there are no exceptions.

I'm making both init and connect call in a IO Dispatcher.

The funny thing is if I attach HttpLoggingInterceptor I can see 200 for the api call.

I have tried by calling eventsource.readAnyEvent() as well which internally connects to the server first and it's the same result.

My code snippets:

This is init call:


private var source: EventSource? = null

val uri = URI.create(url)
val connectStrategy = HttpConnectStrategy.http(uri).httpClient(okHttpClient) //my custom client
val eventSourceBuilder = EventSource.Builder(connectStrategy)
      .errorStrategy(ErrorStrategy.alwaysThrow())
      .logger(LDLogger.withAdapter(rtcLogger, TAG)) //my custom logger
      .retryDelay(realTimeEventsConfig.reconnectTimeInSeconds, TimeUnit.SECONDS)
      .retryDelayStrategy(
                DefaultRetryDelayStrategy.defaultStrategy().maxDelay(
                    realTimeEventsConfig.maxReconnectTimeInSeconds, TimeUnit.SECONDS)
        )

source = eventSourceBuilder.build()

Connect call:

try {
     disconnect(shouldClear = false)
     source?.start()
} catch (e: Exception) {
      //log exception
 }

Can you please let me know what can be the issue?

Edit: If I dont use custom http client it works

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions