Skip to content

Client connections when internet lost #96

Description

@rakirox

Hi there, I have found an issue.

I am trying to handle all my internet connections handlers, reconnections and disconnections. The meteor handlers works just find OnDiscconnected and onException etc.

My approach right now to reconnect once the internet is back (without having a broadcast from android telling me the internet state). Is the next one:

@Override public void onDisconnect() { Log.e("gotDisconnected","well..."); mMeteor.reconnect(); }

and it works well, it gets reconnect but the problem is that all web sockets that tried to connect while the internet was off are getting connected.

    /**
    * Opens a connection to the server over websocket
    *
    * @param isReconnect whether this is a re-connect attempt or not
    */
    private void openConnection(final boolean isReconnect) {
            if (isReconnect) {
                    if (mConnected) {
                            initConnection(mSessionID);
                            return;
                    }
            }

    // create a new WebSocket connection for the data transfer
    mWebSocket = new WebSocket(URI.create(mServerUri));

    // attach the handler to the connection
    mWebSocket.setEventHandler(mWebSocketEventHandler);

    try {
        mWebSocket.connect();
    }
    catch (WebSocketException e) {
        mCallbackProxy.onException(e);
    }
}

first I saw at my galaxy dashboard that my server was getting 100+ clients when I'm the only one running tests. Then on my log I found a lot of exceptions after my internet was reestablished.

:remote E/METEOR EXCEPTION: unknown host: wagen.meteorapp.com
:remote E/gotDisconnected: well...
:remote E/METEOR EXCEPTION: error while sending data: not connected
:remote E/data removed: kadira_settings
:remote E/info: {"emails":[{"address":"some@email.com","verified":true}],"profile":{"name":"Carlos Palmero","type":"Driver","boss":"p4QQGew7EqbYr4TWg","connection":true,"currentStatus":1,"statusStack":[{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463417312821}},{"status":{"name":"On Service","description":"When the driver has started his service","color":"#00ff00"},"timeStamp":{"$date":1463418509087}},{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463422746940}}]}}
:remote E/gotConnected: is signed in?yep
:remote E/data removed: kadira_settings
:remote E/METEOR EXCEPTION: IO Error
:remote E/gotDisconnected: well...
:remote E/METEOR EXCEPTION: IO Exception
:remote E/data removed: kadira_settings
:remote E/info: {"emails":[{"address":"some@email.com","verified":true}],"profile":{"name":"Carlos Palmero","type":"Driver","boss":"p4QQGew7EqbYr4TWg","connection":true,"currentStatus":1,"statusStack":[{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463417312821}},{"status":{"name":"On Service","description":"When the driver has started his service","color":"#00ff00"},"timeStamp":{"$date":1463418509087}},{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463422746940}}]}}
:remote E/gotConnected: is signed in?yep
:remote E/data removed: kadira_settings
:remote E/gotDisconnected: well...
:remote E/METEOR EXCEPTION: error while sending data: not connected
:remote E/data removed: kadira_settings
:remote E/info: {"emails":[{"address":"some@email.com","verified":true}],"profile":{"name":"Carlos Palmero","type":"Driver","boss":"p4QQGew7EqbYr4TWg","connection":true,"currentStatus":1,"statusStack":[{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463417312821}},{"status":{"name":"On Service","description":"When the driver has started his service","color":"#00ff00"},"timeStamp":{"$date":1463418509087}},{"status":{"name":"Solving Ticket","description":"When the driver has arrived and start doing the service","color":"#6600cc"},"timeStamp":{"$date":1463422746940}}]}}
:remote E/gotConnected: is signed in?yep
:remote E/data removed: kadira_settings

and after I force quit it this displayed at Log:

E/METEOR EXCEPTION: Connection closed before handshake was complete

a lot of times btw

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions