0

Alljoyn.js Error: Peer has disconnected

asked 2015-05-05 09:13:04 -0700

AllJoyner gravatar image

updated 2015-05-05 09:14:13 -0700

I am calling a checkRoomLight function every few seconds on one of the Arduino Yun boards and then calling AJ.METHOD on other 3 boards when the light level changes. Most of the time it works fine, but a couple of times i got this error:

    ReferenceError: Peer has disconnected
    ajs_sessions.c:72
    light_0040dd44_0001 light strict preventsyield
    checkRoomLight inference_engine.js:103 preventsyield

Whats strange to me is that even after this error i was able to see a device that got disconnected in Alljoyn ON and control it. On the other side, the script with 'checkRoomLight' function stopped executing.
What exactly is happening here and how would i work around it?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-05 14:58:34 -0700

jprestwo gravatar image

Getting a peer disconnected callback means that the AllJoyn.js device got a session lost signal from that peer. Either that peer sent a session lost signal, because it really was disconnected, or the routing node could no longer find that peer and sent a session lost on its behalf. Are all your devices in a session together? Meaning did they all receive a peer disconnected callback? BTW a peer disconnected callback is not for the AllJoyn.js instance thats running, its for some other peer that is no longer in the session. Perhaps you should print out what peer got disconnected and also print unique names on the other devices to see whats going on.

AJ.onPeerDisconnected = function(peer)
{
    print(peer);
}
edit flag offensive delete publish link more

Comments

I dont think they are all in a session together, because only on one device i called AJ.findService() for or all other devices, so im guessing only that particular device is in a session with all others. But I dont get it why my client application stops after one of the peers is disconnected?

AllJoyner ( 2015-05-07 07:21:38 -0700 )edit

In my client application, i have a function such as in light.js device1.method().call(); // device1 gets disconnected, client app return an error device2.method().call(); // device2 method never gets executed because

AllJoyner ( 2015-05-07 07:26:30 -0700 )edit

I just did more testing and noticed that even after the device joins the session again im still not able to call its methods anymore!? Although i keep reference to a service object when it connects i still get this error: [object Object]ReferenceError: Peer has disconnected

AllJoyner ( 2015-05-07 08:16:04 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-05-05 09:13:04 -0700

Seen: 113 times

Last updated: May 05 '15