Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket "Webhook" not working #366

Closed
matgnt opened this issue Feb 7, 2020 · 1 comment · Fixed by #377
Closed

Websocket "Webhook" not working #366

matgnt opened this issue Feb 7, 2020 · 1 comment · Fixed by #377
Assignees

Comments

@matgnt
Copy link
Contributor

matgnt commented Feb 7, 2020

Hi all,

from the code in server.py I found that websockets are a way to receive push notifications. I very much like this idea! After playing around with it a little, I could only receive the very first message after I connected to the /ws endpoint. 1 message on the "settings" topic. Right after this message, the connection got closed.

After debugging aca-py a bit, I can locate the issue now.
I used version 0.4.1, but no change in server.py since then.

send = loop.create_task(queue.dequeue(timeout=5.0))
https://github.com/hyperledger/aries-cloudagent-python/blob/master/aries_cloudagent/admin/server.py#L364

The timeout can cause an asyncio.TimeoutError exception.
(raised in basic.py)

If that happens, it's not detected until this call:
msg = send.result()
https://github.com/hyperledger/aries-cloudagent-python/blob/master/aries_cloudagent/admin/server.py#L380

This call re-raises the exception from inside the task and causes the whole loop to stop and jump to the finally block and cleans up the websocket queue.
Websocket closed now and it can't be used in send_webhook any more.
https://github.com/hyperledger/aries-cloudagent-python/blob/master/aries_cloudagent/admin/server.py#L427

I see a few options:

  • catch the asyncio.TimeoutError near the send.result() call (or somewhere later, still inside the loop) or
  • test for send.exception() before the result() call

Any thoughts on this?

Thanks and have a nice evening,
Matthias

@swcurran
Copy link
Member

swcurran commented Feb 7, 2020

@andrewwhitehead - can you please take a look at this? Thanks!

andrewwhitehead added a commit to andrewwhitehead/aries-cloudagent-python that referenced this issue Feb 18, 2020
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants