Socket channel does not return json messages
See original GitHub issueRasa version: 1.1.3
Python version: 3.7.3
Operating system (windows, osx, …): WSL Ubuntu 16.04
Issue: Attempting to send custom json response over socket channel returns null instead.
Steps to recreate:
- Initialize a new rasa project.
- Update the templates in domain with custom json.
- Update the credentials file allowing socket channel.
- Send message ‘hi’ over socket connection. (I’m using Rasa-Webchat as the interface
Content of credentials file (credentials.yml):
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/user-guide/messaging-and-voice-channels/
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: false
rasa:
url: "http://localhost:5002/api"
Content of domain file (domain.yml):
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
actions:
- utter_greet
- utter_cheer_up
- utter_did_that_help
- utter_happy
- utter_goodbye
templates:
utter_greet:
- custom:
text: "Hey! How are you?"
something: "wrong"
utter_cheer_up:
- text: "Here is something to cheer you up:"
image: "https://i.imgur.com/nGF1K8f.jpg"
utter_did_that_help:
- text: "Did that help you?"
utter_happy:
- text: "Great carry on!"
utter_goodbye:
- text: "Bye"
The above configuration runs successfully under rasa shell
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
PHP socket shoud return json but returns warning
So it seems socket_recv returns false. why? Is that because of json object in response from server? And how to fix that? Any...
Read more >SocketChannel.read methods returns '0' for a blocking ...
I am using a blocking socket channel in a client code. Here is the code section which shows the way I am getting...
Read more >Writing WebSocket client applications - Web APIs | MDN
The constructor will throw a SecurityError if the destination doesn't allow access. This may happen if you attempt to use an insecure connection ......
Read more >Phoenix.Socket — Phoenix v1.6.15 - HexDocs
A socket implementation that multiplexes messages over channels. Phoenix.Socket is used as ... For sockets requiring no authentication, nil can be returned ......
Read more >Web API implementation - Best practices for cloud applications
The body of a response message may contain data in a variety of formats. For example, an HTTP GET request could return data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did a bit of debugging on my own and following are my findings:
json_message
for rasa’s socketio channel method for sending custom json. Reference: socketio.py line-92data
for emitting response, which does not exist. Hence, I updated the domain template to:This now correctly populates in response.
Conclusion: The custom template should be enclosed under the key
data
for custom json response.Having an example for the same would have been helpful. Personally I feel the
data
key is redundant for a custom json output in socket channel and could have been abstracted from the user.Please feel free to close this issue.
Makes sense. Thanks for the clarification and help.