Scarlet icon indicating copy to clipboard operation
Scarlet copied to clipboard

Can't add any header to request of SocketIO client

Open OleksandrYev opened this issue 6 years ago • 0 comments

I use your great library for SocketIO connection https://github.com/Tinder/Scarlet/tree/0.2.x, but I have some troubles with adding a header to Request via OkHttpClient.Builder - all of them are ignored

val okHttpClient = OkHttpClient.Builder()
        .apply {
          addInterceptor { chain ->
            val accessToken = "...."
            val request = chain.request().newBuilder() 
                .header("Authorization", "$accessToken")
                .build()
            chain.proceed(request)
          }
        }
        .build()
    val options = IO.Options()
    options.callFactory = okHttpClient
    options.webSocketFactory = okHttpClient

I noticed that your client based on https://github.com/socketio/socket.io-client-java, and they described ability to add headers by using some transport event

Screen Shot 2019-06-15 at 16 58 35

but I didn't find any similar API in Scarlet. Do you plan to add support of headers for SocketIO client?

OleksandrYev avatar Jun 15 '19 14:06 OleksandrYev