tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

Stream error #692

Closed ResonantWave closed 9 years ago

ResonantWave commented 9 years ago

I am getting a stream error few minutes after starting yowsup. I am also using the sample app provided. I think it is related with ack.

<stream:error>
<ack>
</ack>
</stream:error>
CODeRUS commented 9 years ago

not sending ack after receiving notification or message

ResonantWave commented 9 years ago

I assumed that, but I don't know what exactly to do. I'm using the sample code, and apparently it should send ack's

CODeRUS commented 9 years ago

check previous log and see after which messages ack is not sent.

ResonantWave commented 9 years ago

Just before the ack error:

<receipt participant="@s.whatsapp.net" t="1426860437" from="@g.us" id="1426860408-7" type="read">
<list>
<item id="1426860307-1">
</item>
<item id="1426860308-3">
</item>
</list>
</receipt>
CODeRUS commented 9 years ago

not this one. acks are sending for <message> and <notification> nodes

ResonantWave commented 9 years ago

Sorry for my incompetence then, but I don't know how to look.

CODeRUS commented 9 years ago

look from beginnig :)

ResonantWave commented 9 years ago

What should I look for?

CODeRUS commented 9 years ago

you should look for nodes with message and notification tags

CODeRUS commented 9 years ago

seems you just didn't added YowAckProtocolLayer

ResonantWave commented 9 years ago

Yes, I did add it. It is just the sample app (https://github.com/tgalal/yowsup/wiki/Yowsup-2.0-Sample-app). It includes the AckProtocolLayer in run.py

ResonantWave commented 9 years ago

It is strange, because the last message I can see in the log has an ack. After that, some receipt and finally the crash

ResonantWave commented 9 years ago

I don't know if this is normal, but there are 2 types of ack

<ack type="delivery" id="1426857499-27" class="receipt">

and

<ack count="21" t="1426860377" from="@g.us" id="1426860376-6" class="message">
ResonantWave commented 9 years ago

So, any ideas?

igormsg commented 9 years ago

i got this error too

lcmeyer37 commented 9 years ago

I get this error for 'videos' and 'audio' media types. I notice that in Echo sample app and yowsup-cli when I receive this type of media I just get one grey check, so WhatsApp servers keep sending this data to my client and then it crashes with that error. Does anyone know how to implement receipt and ack for audio and video media types?

tgalal commented 9 years ago

626

gonzalosr commented 9 years ago

Same problem here, but it seems to be a problem with delivery receipt acks.

Updated to the master branch today to no avail, maybe I am missing something in my code.

here is the full debug log:

DEBUG    30-04-2015 12:22 layer.py:13  : rx:
<receipt offline="3" retry="3" from="xxxxx@s.whatsapp.net" id="1430386282-39" t="1430386165">
</receipt>

DEBUG    30-04-2015 12:22 layer.py:8   : tx:
<ack class="receipt" type="delivery" id="1430386282-39">
</ack>

DEBUG    30-04-2015 12:22 layer.py:13  : rx:
<ib from="s.whatsapp.net">
<offline count="1">
</offline>
</ib>

DEBUG    30-04-2015 12:23 xmlstream.py:1683: Scheduled event: Session timeout check: ()
DEBUG    30-04-2015 12:23 layer.py:13  : rx:
<stream:error>
<ack>
</ack>
</stream:error>

Thanks in advance for any help on this issue

trx222 commented 9 years ago

I also have this problem with php port - https://github.com/mgp25/Chat-API/issues/76

aesedepece commented 9 years ago

I think the error is that now ACKs MUST contain the to="xxxxx@s.whatsapp.net" attribute.

mgp25 commented 9 years ago

Fixed in php: https://github.com/mgp25/Chat-API/commit/07d28e15ce1a41793556230f61441d9705119d20

You can compare and fix it in python.

Regards

aesedepece commented 9 years ago

Thanks a lot @mgp25. You are our hero :)

mgp25 commented 9 years ago

This should be the result, so you can compare:

tx  <message to="xxx@s.whatsapp.net" type="text" id="1430479701-3" t="1430479701">
tx    <body>test</body>
tx  </message>

rx  <ack from="xxx@s.whatsapp.net" id="1430479701-3" class="message" t="1430479701"></ack>

rx  <receipt from="xxx@s.whatsapp.net" id="1430479701-3"></receipt>

tx  <ack to="xxx@s.whatsapp.net" class="receipt" id="1430479701-3"></ack>
gonzalosr commented 9 years ago

Wow. Thanks @mgp25

ameliemaia commented 9 years ago

Can someone upload a fix for this please? : )

aguiraf commented 9 years ago

Thanks @mgp25 for the hint! The outgoing ack not only needs the to="..." attribute but also a type="read" for those <receipt> which carry that attribute. Just pushed a PR that fix all these: #756

emamirazavi commented 9 years ago

many thanks Rafael.

On Sat, May 2, 2015 at 12:59 AM, rafael notifications@github.com wrote:

Thanks @mgp25 https://github.com/mgp25 for the hint! The outgoing ack not only needs the to="..." attribute but also a type="read" for those which carry that attribute. Just pushed a PR that fix all these: #756 https://github.com/tgalal/yowsup/pull/756

— Reply to this email directly or view it on GitHub https://github.com/tgalal/yowsup/issues/692#issuecomment-98228129.

gonzalosr commented 9 years ago

Thanks Rafael. Your fix works great.

matteocontrini commented 9 years ago

The fix is by @CODeRUS, after the issue was raised here. You have to thank him...

ameliemaia commented 9 years ago

Thanks Rafael, works perfectly now.

emamirazavi commented 9 years ago

Hi, I again have this problem... apparently sometimes i have no ack sent(tx) after reading some group messages!

Logged in! ??9393310102@s.whatsapp.net 2015-05-05 22:09:31,345 DEBUG rx:

2015-05-05 22:09:31,368 DEBUG rx: <message retry="1" participant="??9359621023@s.whatsapp.net" t="1430833909" from="??9103871392-1423772032@g.us" offline="1" type="media" id="1430833865-2" notify="TEST TEST"> ...

2015-05-05 22:09:31,369 DEBUG rx:

2015-05-05 22:10:31,402 DEBUG rx: stream:error

/stream:error

On Sat, May 2, 2015 at 7:44 PM, Tarek notifications@github.com wrote:

Closed #692 https://github.com/tgalal/yowsup/issues/692 via 874d217 https://github.com/tgalal/yowsup/commit/874d2176e5016a8e31c2493dbb5466a438db7721 .

— Reply to this email directly or view it on GitHub https://github.com/tgalal/yowsup/issues/692#event-295494958.

volumetric commented 9 years ago

Thanks a lot @aguiraf This took the whole 2 days for me, but finally a persistent connection.