Git Product home page Git Product logo

Comments (11)

hrqiang avatar hrqiang commented on July 23, 2024 2

I've resolved this issue recently. This will not be an issue once rasa_core release a new version. 0.12.4+.
For now, the work around is you install a github latest version rasa-core or replace your channels/socketio.py with github latest one.

from rasa-webchat.

colinhobbs avatar colinhobbs commented on July 23, 2024

i am seeing the same behavior..

Using webchat Versions 0.5.3, 0.5.2 or 0.5.0 in a <script> tag

I see client the connection to my Rasa Server and its sending a Session_request event, but it does not appear to be sending the initPayload. ( or at least rasa is not registering it. )
web console is free of errors.
dropping back to webchat version 0.4.2 everything works as expected..

script config

   WebChat.default.init({
   selector: "#webchat",
   initPayload: "utter_greet",
   interval: 1000, // 1000 ms between each message
   socketUrl: "http://test-server:5004",
   socketPath: "/socket.io/",
   title: "Web Chat",
   inputTextFieldHint: "Type a message...",
   connectingText: "Waiting for server...",
   fullScreenMode: false,
   profileAvatar: "http://test-server:8080/images/dhelmet.png",
   hideWhenNotConnected: false,
       params: {
         images: {
             dims: {
           width: 300,
          height: 200,
             }
       },
   storage: "local"
   }
   })
   WebChat.show()

rasa-core 0.12.4
rasa-core-sdk 0.12.1
rasa-nlu 0.13.8

Rasa Logs

2019-01-16 16:48:48 INFO     engineio  - a58e949e8fd34a8293791f08992524a9: Sending packet OPEN data {'sid': 'a58e949e8fd34a8293791f08992524a9', 'pingTimeout': 60000, 'upgrades': [], 'pingInterval': 25000}
2019-01-16 16:48:48 INFO     engineio  - a58e949e8fd34a8293791f08992524a9: Sending packet MESSAGE data 0
10.83.174.147 - - [2019-01-16 16:48:48] "GET /socket.io/?EIO=3&transport=polling&t=MXOsaeq HTTP/1.1" 200 366 0.001168
2019-01-16 16:48:48 INFO     engineio  - a58e949e8fd34a8293791f08992524a9: Received packet MESSAGE data 2["session_request",{}]
2019-01-16 16:48:48 INFO     socketio  - received event "session_request" from a58e949e8fd34a8293791f08992524a9 [/]
10.83.174.147 - - [2019-01-16 16:48:48] "POST /socket.io/?EIO=3&transport=polling&t=MXOsarn&sid=a58e949e8fd34a8293791f08992524a9 HTTP/1.1" 200 196 0.000820
2019-01-16 16:49:13 INFO     engineio  - a58e949e8fd34a8293791f08992524a9: Received packet PING data None
2019-01-16 16:49:13 INFO     engineio  - a58e949e8fd34a8293791f08992524a9: Sending packet PONG data None

Hope that helps...

from rasa-webchat.

znat avatar znat commented on July 23, 2024

Are you able to talk to the bot? Does it answer?

from rasa-webchat.

jeanpah avatar jeanpah commented on July 23, 2024

@znat No, the input is disabled. but the connection to the server is logged. Im using firefox, the version of the plugin is the latest, im using the script tag.

@colinhobbs Thanks!, this rolling back the js client to version 0.4.2 make it work as expected.

from rasa-webchat.

znat avatar znat commented on July 23, 2024

Did you set session_persistence: true in the SocketIOInput section of the credentials.yaml file?

from rasa-webchat.

jeanpah avatar jeanpah commented on July 23, 2024

@znat sorry i'm using only socket.io for the backend, im not using rasa at the moment. but usign version 0.4.2 made the plugin work with a simple echo bot:

const server = require('http').createServer();
const io = require('socket.io')(server);
io.on('connection', function(socket){
  console.log('a user connected');
  //console.log(socket)
  io.emit('bot_uttered', {"text": "hola, soy jean pierre el servidor"})
  socket.on('user_uttered',function(message){
    io.emit('bot_uttered', {"text": message.message})
    return true;
  });
  return true;
});


server.listen(3000);

from rasa-webchat.

colinhobbs avatar colinhobbs commented on July 23, 2024

with rasa.. I do have the session persistence set ..
Rasa config

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: true

I do see the client request a session.. just not seeing rasa respond at all to that request...

I used @jeanpah config on nodejs and could see the same result.. in looking at the logs i see the client connect. I guess i'm not sure what the client is looking for to confirm it has a connection to the server because you can see the client send the heardbeat ping and pong..

Rasa logs

2019-01-17 10:01:38 INFO     engineio  - 4c907a17d8fb4bbcbbe7bdfc15bd4a58: Sending packet OPEN data {'sid': '4c907a17d8fb4bbcbbe7bdfc15bd4a58', 'pingInterval': 25000, 'pingTimeout': 60000, 'upgrades': []}
2019-01-17 10:01:38 INFO     engineio  - 4c907a17d8fb4bbcbbe7bdfc15bd4a58: Sending packet MESSAGE data 0
10.21.144.93 - - [2019-01-17 10:01:38] "GET /socket.io/?EIO=3&transport=polling&t=MXSY-Lb HTTP/1.1" 200 366 0.001052
2019-01-17 10:01:39 INFO     engineio  - 4c907a17d8fb4bbcbbe7bdfc15bd4a58: Received packet MESSAGE data 2["session_request",{}]
2019-01-17 10:01:39 INFO     socketio  - received event "session_request" from 4c907a17d8fb4bbcbbe7bdfc15bd4a58 [/]
10.21.144.93 - - [2019-01-17 10:01:39] "POST /socket.io/?EIO=3&transport=polling&t=MXSY-OP&sid=4c907a17d8fb4bbcbbe7bdfc15bd4a58 HTTP/1.1" 200 196 0.000743
2019-01-17 10:02:04 INFO     engineio  - 4c907a17d8fb4bbcbbe7bdfc15bd4a58: Received packet PING data None
2019-01-17 10:02:04 INFO     engineio  - 4c907a17d8fb4bbcbbe7bdfc15bd4a58: Sending packet PONG data None
10.21.144.93 - - [2019-01-17 10:02:04] "POST /socket.io/?EIO=3&transport=polling&t=MXSZ4V1&sid=4c907a17d8fb4bbcbbe7bdfc15bd4a58 HTTP/1.1" 200 196 0.000714
10.21.144.93 - - [2019-01-17 10:02:04] "GET /socket.io/?EIO=3&transport=polling&t=MXSY-OQ&sid=4c907a17d8fb4bbcbbe7bdfc15bd4a58 HTTP/1.1" 200 212 24.952678

Hope that helps..

from rasa-webchat.

jeanpah avatar jeanpah commented on July 23, 2024

@hrqiang Is there any solution for socket.io?

from rasa-webchat.

dliuproduction avatar dliuproduction commented on July 23, 2024

check issue #28

from rasa-webchat.

jeanpah avatar jeanpah commented on July 23, 2024

Hi everyone,

I managed to make the plugin work in version 0.5.3 with socket.io. it was fixed by adding two more events to the socket script "session_request, session_confirm":

const server = require('http').createServer();
const io = require('socket.io')(server);
const request = require('request');


io.on('connection', function(socket){
  console.log('a user connected');
  //console.log(socket)

  socket.on('session_request',function(id){
    return id.session_id
  })

  io.emit("session_confirm","hola")
  io.emit('bot_uttered', {"text": "hola, soy jean pierre el servidor"})

  socket.on('user_uttered',function(message){
    bot_data = {
      "object":"page",
      "entry":[
        {
          "messaging":[
            {
              "sender":{"id":"2149648825097538"},
              "recipient":{"id":"654472771621094"},
              "message": {"text":message.message}
            }
          ]
        }
      ]
    }


    var options = {
      uri: 'http://127.0.0.1:8080/messengerBotWebhook',
      method: 'POST',
      json: bot_data
    };
    request(options, (err, res, body) => {
      if (err) { return console.log(err); }
      //console.log(body.url);
      try{
        result = JSON.parse(body);
        console.log(result)
      }catch(e){
        console.log(e)
      }
    });
    io.emit('bot_uttered', {"text": "simon dice "+message.message})
    return true;
  });
  return true;
});


server.listen(3000);

from rasa-webchat.

znat avatar znat commented on July 23, 2024

Right, of course! Thanks @jeanpah .
Would you consider adding them in the readme in a PR?

from rasa-webchat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.