|
10 | 10 | "\n",
|
11 | 11 | "In this notebook we'll be going through the Action Menu Protocol. For details on the protocol, please refer to the [RFC](https://github.com/hyperledger/aries-rfcs/tree/master/features/0509-action-menu).\n",
|
12 | 12 | "\n",
|
13 |
| - "A requirement for this protocol to work is an active DIDComm communication channel between Alice and Bob. To achieve that, you should have completed the [Establishing a Connection](http://localhost:8888/notebooks/Part%203%20-%20Establishing%20a%20Connection.ipynb) tutorial." |
| 13 | + "A requirement for this protocol to work is an active DIDComm communication channel between Alice and Bob. To achieve that, you should have completed the [Establishing a Connection](http://127.0.0.1:8888/notebooks/Part%203%20-%20Establishing%20a%20Connection.ipynb) tutorial." |
14 | 14 | ]
|
15 | 15 | },
|
16 | 16 | {
|
|
24 | 24 | },
|
25 | 25 | {
|
26 | 26 | "cell_type": "code",
|
27 |
| - "execution_count": 20, |
| 27 | + "execution_count": 1, |
28 | 28 | "metadata": {},
|
29 | 29 | "outputs": [
|
30 | 30 | {
|
|
74 | 74 | "loop = asyncio.get_event_loop()\n",
|
75 | 75 | "loop.create_task(agent_controller.listen_webhooks())\n",
|
76 | 76 | "\n",
|
77 |
| - "agent_controller.register_listeners([], defaults=True)" |
| 77 | + "def action_menu_handler(payload):\n", |
| 78 | + " print(\"Action Menu Handler Called\")\n", |
| 79 | + " print(f\"Payload {payload}\")\n", |
| 80 | + " connection_id = payload[\"connection_id\"]\n", |
| 81 | + " state = payload[\"state\"]\n", |
| 82 | + " print(f\"Connection {connection_id} in State {state}\")\n", |
| 83 | + " \n", |
| 84 | + "action_menu_listener = {\n", |
| 85 | + " \"handler\": action_menu_handler,\n", |
| 86 | + " \"topic\": \"connections\"\n", |
| 87 | + "}\n", |
| 88 | + "\n", |
| 89 | + "agent_controller.register_listeners([action_menu_listener], defaults=True)" |
78 | 90 | ]
|
79 | 91 | },
|
80 | 92 | {
|
|
85 | 97 | "\n",
|
86 | 98 | "An active connection between Alice and Bob is required. You can either:\n",
|
87 | 99 | "\n",
|
88 |
| - "- complete the [Establishing a Connection](http://localhost:8888/notebooks/Part%203%20-%20Establishing%20a%20Connection.ipynb) tutorial, or\n", |
89 |
| - "- running the python script `create_connection.py` in the setup folder, or\n", |
90 |
| - "- complete the did-exchange tutorial ([Alice](http://localhost:8888/notebooks/did-exchange-inviter.ipynb) and [Bob](http://localhost:8889/notebooks/did-exchange-invitee.ipynb)) " |
| 100 | + "- complete the [Establishing a Connection](http://127.0.0.1:8888/notebooks/Part%203%20-%20Establishing%20a%20Connection.ipynb) tutorial, or\n", |
| 101 | + "- running the python script `create_connection.py` in the setup folder" |
91 | 102 | ]
|
92 | 103 | },
|
93 | 104 | {
|
|
152 | 163 | "cell_type": "markdown",
|
153 | 164 | "metadata": {},
|
154 | 165 | "source": [
|
155 |
| - "## 5. Continue with step 6 of [Bob's notebook](http://localhost:8889/notebooks/Part%208%20-%20Action%20Menu.ipynb)" |
| 166 | + "## 5. Continue with step 6 of [Bob's notebook](http://127.0.0.1:8889/notebooks/Part%209%20-%20Action%20Menu.ipynb)" |
156 | 167 | ]
|
157 | 168 | },
|
158 | 169 | {
|
|
250 | 261 | },
|
251 | 262 | {
|
252 | 263 | "cell_type": "code",
|
253 |
| - "execution_count": 21, |
| 264 | + "execution_count": 6, |
254 | 265 | "metadata": {},
|
255 | 266 | "outputs": [
|
256 | 267 | {
|
257 |
| - "name": "stdout", |
258 |
| - "output_type": "stream", |
259 |
| - "text": [ |
260 |
| - "None\n" |
| 268 | + "ename": "RuntimeError", |
| 269 | + "evalue": "Site <aiohttp.web_runner.TCPSite object at 0x7fee28bec250> is not registered in runner <aiohttp.web_runner.AppRunner object at 0x7fee28c25cb0>", |
| 270 | + "output_type": "error", |
| 271 | + "traceback": [ |
| 272 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 273 | + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", |
| 274 | + "\u001b[0;32m<ipython-input-6-5870155ffed5>\u001b[0m in \u001b[0;36masync-def-wrapper\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 275 | + "\u001b[0;32m/aries_basic_controller/aries_controller.py\u001b[0m in \u001b[0;36mterminate\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0;32mawait\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient_session\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwebhook_site\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 115\u001b[0;31m \u001b[0;32mawait\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwebhook_site\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 116\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 117\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", |
| 276 | + "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/aiohttp/web_runner.py\u001b[0m in \u001b[0;36mstop\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 56\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_runner\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_site\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 57\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_server\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_runner\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_unreg_site\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 277 | + "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/aiohttp/web_runner.py\u001b[0m in \u001b[0;36m_check_site\u001b[0;34m(self, site)\u001b[0m\n\u001b[1;32m 276\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msite\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sites\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 277\u001b[0m raise RuntimeError(\"Site {} is not registered in runner {}\"\n\u001b[0;32m--> 278\u001b[0;31m .format(site, self))\n\u001b[0m\u001b[1;32m 279\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 280\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_unreg_site\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msite\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mBaseSite\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 278 | + "\u001b[0;31mRuntimeError\u001b[0m: Site <aiohttp.web_runner.TCPSite object at 0x7fee28bec250> is not registered in runner <aiohttp.web_runner.AppRunner object at 0x7fee28c25cb0>" |
261 | 279 | ]
|
262 | 280 | }
|
263 | 281 | ],
|
264 | 282 | "source": [
|
265 | 283 | "response = await agent_controller.terminate()\n",
|
266 | 284 | "print(response)"
|
267 | 285 | ]
|
| 286 | + }, |
| 287 | + { |
| 288 | + "cell_type": "code", |
| 289 | + "execution_count": null, |
| 290 | + "metadata": {}, |
| 291 | + "outputs": [], |
| 292 | + "source": [] |
268 | 293 | }
|
269 | 294 | ],
|
270 | 295 | "metadata": {
|
|
0 commit comments