android client error: working on dead thread

#1

I have been using the autobahn library for an Android App that I am developing for smartphones.
I have been watching it over the last few months and it appears that the websocket connection ‘goes away’ without any notification to the onClose method of the mConnection object.

I have a tomcat7 server that broadcasts the server time every 30 seconds to each Android device that is connected to the server. On the smartphone it keeps track of the server times and triggers an event if too much time goes by since last incoming server time.

If too much time passes then I test the websocket by testing the mConnection.isConnected() and it always returns true even when I specifically try to use the mConnection to request something from server, which never returns.

I see in the System.out.print that an error is being thrown about tavendo working on a dead thread.

Is there a solution for this?

More importantly, what is the best way of knowing within 2-3 seconds that the websocket is not actually connected or is in the process of trying to automatically reconnect itself (does it actively try to reconnect automatically?)?

Thanks,

Keith

0 Likes

#2

More Context:I have an Android SERVICE that runs in the background that shows either a green or red dot to show the user whether the phone has an open connection with the server. As soon as the connection is closed or lost then the dot goes red, same for green. The idea is to keep that dot the correct color within 2-3 of accuracy.

···

On Wednesday, December 11, 2013 8:52:06 AM UTC-5, Keith Pittner wrote:

I have been using the autobahn library for an Android App that I am developing for smartphones.
I have been watching it over the last few months and it appears that the websocket connection ‘goes away’ without any notification to the onClose method of the mConnection object.

I have a tomcat7 server that broadcasts the server time every 30 seconds to each Android device that is connected to the server. On the smartphone it keeps track of the server times and triggers an event if too much time goes by since last incoming server time.

If too much time passes then I test the websocket by testing the mConnection.isConnected() and it always returns true even when I specifically try to use the mConnection to request something from server, which never returns.

I see in the System.out.print that an error is being thrown about tavendo working on a dead thread.

Is there a solution for this?

More importantly, what is the best way of knowing within 2-3 seconds that the websocket is not actually connected or is in the process of trying to automatically reconnect itself (does it actively try to reconnect automatically?)?

Thanks,

Keith

0 Likes

#3

I have been using the autobahn library for an Android App that I am
developing for smartphones.
I have been watching it over the last few months and it appears that the
websocket connection 'goes away' without any notification to the onClose
method of the mConnection object.

If you don't send data on a TCP WAN connection, there is no way to tell if the other end has gone away.

I have a tomcat7 server that broadcasts the server time every 30 seconds
to each Android device that is connected to the server. On the
smartphone it keeps track of the server times and triggers an event if
too much time goes by since last incoming server time.
If too much time passes then I test the websocket by testing the
mConnection.isConnected() and it always returns true even when I
specifically try to use the mConnection to request something from
server, which never returns.
I see in the System.out.print that an error is being thrown about
tavendo working on a dead thread.

Is there a solution for this?

Try to send data also upstream (from client to server).

More importantly, what is the best way of knowing within 2-3 seconds
that the websocket is not actually connected or is in the process of

Keeping a TCP connection alive and snappy on mobile is non-trivial. This has nothing to do with Autobahn or WebSocket, but everything with TCP and mobile networks. Which doesn't mean we couldn't improve things with AutobahnAndroid nor that there are no bugs in AutobahnAndroid;)

To give you a flavor of the issues involved, you might have a look at this thread:

http://lists.w3.org/Archives/Public/ietf-http-wg/2012JanMar/1083.html

/Tobias

···

Am 11.12.2013 14:52, schrieb Keith Pittner:

trying to automatically reconnect itself (does it actively try to
reconnect automatically?)?

Thanks,
Keith

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes

#4

Thanks so much for the reply and link!
Probably a dumb question but …

Instead of sending small strings to server using mConnect.sendTextMessage(payload) and wait for an answer in the onTextMessage method, is there a way to get a callback so I don’t have to try to link the two different actions. Not for everything but just to use for a ping/pong action from client to server as you suggested?

···

On Wednesday, December 11, 2013 8:52:06 AM UTC-5, Keith Pittner wrote:

I have been using the autobahn library for an Android App that I am developing for smartphones.
I have been watching it over the last few months and it appears that the websocket connection ‘goes away’ without any notification to the onClose method of the mConnection object.

I have a tomcat7 server that broadcasts the server time every 30 seconds to each Android device that is connected to the server. On the smartphone it keeps track of the server times and triggers an event if too much time goes by since last incoming server time.

If too much time passes then I test the websocket by testing the mConnection.isConnected() and it always returns true even when I specifically try to use the mConnection to request something from server, which never returns.

I see in the System.out.print that an error is being thrown about tavendo working on a dead thread.

Is there a solution for this?

More importantly, what is the best way of knowing within 2-3 seconds that the websocket is not actually connected or is in the process of trying to automatically reconnect itself (does it actively try to reconnect automatically?)?

Thanks,

Keith

0 Likes

#5

Yes, that's what WAMP RPCs are for .. AutobahnAndroid implements not only WebSocket, but also WAMP ..

/Tobias

···

Am 11.12.2013 17:20, schrieb Keith Pittner:

Thanks so much for the reply and link!
Probably a dumb question but ...
Instead of sending small strings to server using
mConnect.sendTextMessage(payload) and wait for an answer in the
onTextMessage method, is there a way to get a callback so I don't have

0 Likes

#6

ok - that’s what I thought. I saw a question about it on another post. I have the autobahn-0.5.0.jar but can’t find the WAMP library.

···

On Wednesday, December 11, 2013 8:52:06 AM UTC-5, Keith Pittner wrote:

I have been using the autobahn library for an Android App that I am developing for smartphones.
I have been watching it over the last few months and it appears that the websocket connection ‘goes away’ without any notification to the onClose method of the mConnection object.

I have a tomcat7 server that broadcasts the server time every 30 seconds to each Android device that is connected to the server. On the smartphone it keeps track of the server times and triggers an event if too much time goes by since last incoming server time.

If too much time passes then I test the websocket by testing the mConnection.isConnected() and it always returns true even when I specifically try to use the mConnection to request something from server, which never returns.

I see in the System.out.print that an error is being thrown about tavendo working on a dead thread.

Is there a solution for this?

More importantly, what is the best way of knowing within 2-3 seconds that the websocket is not actually connected or is in the process of trying to automatically reconnect itself (does it actively try to reconnect automatically?)?

Thanks,

Keith

0 Likes

#7

ok - that's what I thought. I saw a question about it on another post. I
have the autobahn-0.5.0.jar but can't find the WAMP library.

It's in the source

https://github.com/tavendo/AutobahnAndroid

I don't have time to maintain Jars or mavencentral or such ..

/Tobias

···

Am 11.12.2013 17:37, schrieb Keith Pittner:

On Wednesday, December 11, 2013 8:52:06 AM UTC-5, Keith Pittner wrote:

    I have been using the autobahn library for an Android App that I am
    developing for smartphones.
    I have been watching it over the last few months and it appears that
    the websocket connection 'goes away' without any notification to the
    onClose method of the mConnection object.
    I have a tomcat7 server that broadcasts the server time every 30
    seconds to each Android device that is connected to the server. On
    the smartphone it keeps track of the server times and triggers an
    event if too much time goes by since last incoming server time.
    If too much time passes then I test the websocket by testing the
    mConnection.isConnected() and it always returns true even when I
    specifically try to use the mConnection to request something from
    server, which never returns.
    I see in the System.out.print that an error is being thrown about
    tavendo working on a dead thread.

    Is there a solution for this?
    More importantly, what is the best way of knowing within 2-3 seconds
    that the websocket is not actually connected or is in the process of
    trying to automatically reconnect itself (does it actively try to
    reconnect automatically?)?

    Thanks,
    Keith

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes

#8

ok, understand. Thank you very much for your help. You’ve been very helpful. Have a great day. :slight_smile:

···

On Wednesday, December 11, 2013 8:52:06 AM UTC-5, Keith Pittner wrote:

I have been using the autobahn library for an Android App that I am developing for smartphones.
I have been watching it over the last few months and it appears that the websocket connection ‘goes away’ without any notification to the onClose method of the mConnection object.

I have a tomcat7 server that broadcasts the server time every 30 seconds to each Android device that is connected to the server. On the smartphone it keeps track of the server times and triggers an event if too much time goes by since last incoming server time.

If too much time passes then I test the websocket by testing the mConnection.isConnected() and it always returns true even when I specifically try to use the mConnection to request something from server, which never returns.

I see in the System.out.print that an error is being thrown about tavendo working on a dead thread.

Is there a solution for this?

More importantly, what is the best way of knowing within 2-3 seconds that the websocket is not actually connected or is in the process of trying to automatically reconnect itself (does it actively try to reconnect automatically?)?

Thanks,

Keith

0 Likes