# Websocket response

**URL:** https://community.openconversational.ai/t/websocket-response/11247
**Category:** General Discussion
**Created:** [September 17, 2021, 2:40am UTC](https://community.openconversational.ai/t/websocket-response/11247 "2021-09-17T02:40:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Mac](https://community.openconversational.ai/user_avatar/community.openconversational.ai/john_mac/32/3289_2.png) [@John\_Mac](https://community.openconversational.ai/u/John_Mac)
#### Post date: [September 17, 2021, 2:40am UTC](https://community.openconversational.ai/t/websocket-response/11247/1 "2021-09-17T02:40:18Z")

</div>

I am able to send a query to mycroft core running on my localhost via docker.  
my query is - ‘where is california’ and I see the response in the skills.log as

2021-09-17 02:31:23.812 | INFO | 25 | QuestionsAnswersSkill | Searching for where is california  
California is located on the West Coast of the United States. It shares borders with Oregon, Nevada, and Arizona

However, my websocket client doesn’t see any response.

---

<div class="post-metadata">

### Author: ![John\_Mac](https://community.openconversational.ai/user_avatar/community.openconversational.ai/john_mac/32/3289_2.png) [@John\_Mac](https://community.openconversational.ai/u/John_Mac)
#### Post date: [September 17, 2021, 3:58am UTC](https://community.openconversational.ai/t/websocket-response/11247/2 "2021-09-17T03:58:14Z")

</div>

my client code closed the websocket immediately. I kept it running for a while, and I can see all responses.

> import websocket  
> import threading  
> from time import sleep
> 
> def on\_message(ws, message):  
> print(message)  
> messageDict = json.loads(message)  
> if ‘type’ in messageDict and messageDict[“type”] == ‘speak’:  
> print (“--------------------------------”)
> 
> def on\_close(ws):  
> print(“### closed ###”)
> 
> if **name** == “ **main** ”:  
> #websocket.enableTrace(True)  
> ws = websocket.WebSocketApp(uri,  
> on\_message = on\_message,  
> on\_close = on\_close)  
> wst = threading.Thread(target=ws.run\_forever)  
> wst.daemon = True  
> wst.start()
> 
> ```
> conn_timeout = 5
> while not ws.sock.connected and conn_timeout:
> sleep(1)
> conn_timeout -= 1
> 
> msg_counter = 0
> while ws.sock.connected:
> ws.send(message)
> sleep(40)
> 
> ```
