Skip to content

Socket send timeout #3042

@sagits

Description

@sagits

Hi, i have created a socket connection inside a service using:

    OkHttpClient client = new OkHttpClient.Builder()
                    .readTimeout(3000,  TimeUnit.MILLISECONDS)
                    .writeTimeout(3000,  TimeUnit.MILLISECONDS)
                    .connectTimeout(3000,  TimeUnit.MILLISECONDS)
                    .build();

            Request request = new Request.Builder().addHeader(Config.WEBSOCKET_PARAM_COOKIE, "access_token=" + userToken)
                    .url(mySocketUrl)
                    .build();
            webSocket = client.newWebSocket(request, websocketListener);

Everything works fine, but now i'm trying to simulate a no connection scenario. I have turned on the airplane mode, while in a chat, and tryied to send a message using .send(String). I through that it would fire some kind of exception or the onFailure/onClosed methods, but none of them are called. How can i detect if the .send function really worked? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions