Closed master-xej closed 5 years ago
It appears you haven't started the web socket before posting the question. Please start we socket listener and then post the question to get the response.
Thank you for your reply! But how do I start the websocket? If I just execute the line "start_websocket_listener()" it gives me an error.
Yes, execute the line which says start_websocket_listener(). Before that, update the web socket URL in the notebook as shown in step 10. Please follow the steps as per the documentation and then run the cell which says start_websocket_listener().
Dear Sharath,
I followed all the steps and updated the notebook. Then on execution of the line start_websocket_listener() I get this error: `--------------------------------------------------------------------------- NameError Traceback (most recent call last)
"NameError: name 'start_websocket_listener' is not defined" means this function in the previous cell per below is not executed and hence it is not being recognised. Please update the url in the step 5 and run all cells which will fix the issue. The notebook has been tested and works accurately as per the requirement.
def start_websocket_listener(): websocket.enableTrace(True) ws = websocket.WebSocketApp("update the node-red based url", on_message = on_message, on_error = on_error, on_close = on_close) ws.on_open = on_open ws.run_forever()
I am following up to check whether the issue got resolved? do you have any further questions?
Looks like no follow-up on this. Closing issue as resolved.
When I execute the code I get this error `--- request header --- GET /ws/orchestrate HTTP/1.1 Upgrade: websocket Connection: Upgrade Host: ki-nao.eu-gb.mybluemix.net Origin: http://ki-nao.eu-gb.mybluemix.net Sec-WebSocket-Key: QKOqWNNMf75heCxrF2vdEQ== Sec-WebSocket-Version: 13
--- response header --- HTTP/1.1 101 Switching Protocols Connection: Upgrade Sec-WebSocket-Accept: oIx+fSJ6nTvHanGMAE9nmJiFmLo= Date: Wed, 01 May 2019 14:53:46 GMT X-Global-Transaction-ID: f28b14df5cc9b2fa5d8c0f17 Upgrade: websocket
send: b'\x81\x97 \x94\xb1&[\xb6\xd2KD\xb6\x8b\x04d\xc7\xe9\x06h\xf1\xd0TT\xd6\xd4GT\xb6\xcc' error from callback <function on_message at 0x7ffab0258048>: 'botresponse' File "/opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/websocket/_app.py", line 345, in _callback callback(self, *args) File "", line 7, in on_message
for item in msg["botresponse"]["messageout"]["context"]["entities_array"]:`
What can I do?