This is my code:
import websocket
import json
from datetime import datetime
import os
import time
# Intents are passed through here
def on_message(ws, message):
data = json.loads(message)
print("**Captured New Intent**")
print(data)
if ("Hello" == data["intent"]["name"]):
print("Hello, Sir")
def on_error(ws, error):
print(error)
def on_close(ws):
print("\n**Disconnected**\n")
def on_open(ws):
print("\n**Connected**\n")
# Start web socket client
if __name__ == "__main__":
ws = websocket.WebSocketApp("ws://localhost:12101/api/events/intent",
on_message = on_message,
on_error = on_error,
on_close = on_close)
ws.on_open = on_open
ws.run_forever()
As you can notice, ws = websocket.WebSocketApp(“ws://localhost:12101/api/events/intent”, I only send me the “intent”. If I change it to “wake” it shows me when I say the wakeword. If Change to “text” shows me what you pronounce.
My question is: it is possible to show them the 3 with the same code? That is, I want to receive all the data.