ryanvolum / offline-directline

Unofficial package to emulate the bot framework connector locally.
https://www.npmjs.com/package/offline-directline
78 stars 44 forks source link

User messages in webchat show, "couldn't send, retry" even when the bot receives and responds #4

Closed ryanvolum closed 6 years ago

ryanvolum commented 7 years ago

The connector brokers messages, but webchat still displays error message: image

ryanvolum commented 7 years ago

I'm currently working on a solution for this bug.

ykon550 commented 7 years ago

Hello, @ryanvolum. Thank you for your great implementation of this module. I am also very intersted in this offline communication. and met same error.

I didn't find solution for this issue, but let me share my current findings for this issue.

I just thought bridge.ts did not reply Bot's acknowledgement for receiving. that acknowledge is generated at L527 of ChatConnector.ts

// Acknowledge that we received the events
callback(null, null, 202);

and I added 4lines for passing this acknowledge to WebChat. it is like following at L73 of brdige.ts,

        fetch(botUrl, {
            method: "POST",
            body: JSON.stringify(activity),
            headers: {
                "Content-Type": "application/json"
            }
        }).then(function(response){
            res.status(response.status);
            res.end();
        });

However still I failed to show correct status on WebChat. but, after this change, status on Webchat immidiately say "couldn't send". before this change, I saw it said "sending" for a while and then changed to "couldn't send".

I am a newbie for React and not sure what's going on inside of Webchat. but I think correct respond to webchat is still missing.

I hope you will find solution for this issue.

Kothakapu commented 6 years ago

Hi @ryanvolum,

Could you please update on issue. Did you found any resolution for this?. If so could you please share it with us.

ryanvolum commented 6 years ago

Hey @Kothakapu. Unfortunately I haven't had a chance to track down the issue. Webchat seems to be waiting for a message id to return, which I've done to no avail.

@yzwhy - thanks for the PR. I haven't merged it, since on my end it doesn't seem to be making a difference...

I'll update this issue if I manage to track down the problem.

ryanvolum commented 6 years ago

Scratch that last comment :) @yzwhy's PR seems to have fixed the problem. I've updated the package to 1.1.5 to reflect the changes.

Please let me know if you're still facing issues