Comments (9)
I understand that it's okhttp3 issue.
It would be nice to have possibility to add interceptor in constructor or builder to make restart work around at least.
https://futurestud.io/tutorials/retrofit-2-catch-server-errors-globally-with-response-interceptor
while they are fixing this.
from client-jvm.
Hi @belarusrulez, is this exception making it to the websocket listener's onError
callback?
There is a way to provide your own HttpClientProvider
when constructing your websocket client. Your provider can extend DefaultJvmHttpClientProvider
and override the buildClient
function to return a custom ktor http client. Your custom client can have OkHttp interceptors or use a completely different engine like Apache. More details on Ktor client engines here: https://ktor.io/clients/http-client/engines.html. Just take a look at the default implementation of buildClient
to see what features are required to be installed in the engine.
Ktor can be a bit awkward to work with, so let me know if you have more questions. In the meantime I'll look into making it simple to add OkHttp interceptors to the DefaultJvmHttpClientProvider
from client-jvm.
Thank you for response. Ill try this :)
from client-jvm.
Hello @mmoghaddam385 could you please rebuild it so Ill be able to use this https://github.com/polygon-io/client-jvm/blob/046cb1a3d653a0e0fd6936242d502b78692f052b/src/main/kotlin/io/polygon/kotlin/sdk/HttpClientProvider.kt changes?
Thank you :)
from client-jvm.
Oops, forgot to create a new release! Just created 1.1.0, should be good to go!
from client-jvm.
Hello, Thank you for quick response :)
I've tried to catch this exception .... like this:
looks like it never comes here :D still getting the same stacktrace and disconnect.
from client-jvm.
I was afraid that might happen, it doesn't seem like OkHttp interceptors really do all that much in websocket connections. At this point I'd suggest dropping OkHttp and trying out a different engine. The CIO engine (https://ktor.io/clients/http-client/engines.html#cio) support websockets and should be a drop-in replacement for OkHttp.
See the sample code for an example of how to swap out your http engine. (you'll also need to include the dependency from the ktor.io link above)
Let me know if you have any better luck with CIO, if you do I'll think about making that the default instead of OkHttp for now
from client-jvm.
Hi @belarusrulez, are you still having this issue?
from client-jvm.
I'm going to close this because I think the disconnects were being caused by a server-side issue at the time which has since been fixed. Feel free to re-open if I'm wrong though!
from client-jvm.
Related Issues (20)
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
- Client update needed to match REST spec changes
- Client update needed to match WebSocket spec changes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from client-jvm.