Giter Site home page Giter Site logo

Comments (7)

billba avatar billba commented on July 19, 2024

What are you trying to accomplish?

from botframework-directlinejs.

nicksav avatar nicksav commented on July 19, 2024

@billba I am using DirectLine as underline layer of alerts and communications. (not just bot)
When user opens a portal web page I am making him "online" and he can easily start using chat (bot) etc.
As soon as connection dropped, I want to show that user is offline now and make chat "disabled".

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

(Sorry, at first I misread your code)

It's actually pretty hard to know if we've lost the connection. What does that even mean? If you're using a phone then you may gain and lose the connection on a second by second basis. We could probably all agree that it means "unable to connect over an extended period of time" if we could agree on the definition of "extended".

At this time DLJS doesn't offer a state for this. Attempting to send an activity returns an error, but clients can always retry later (as WebChat does). When listening for activities we just keep trying.

It would be interesting to define a heuristic for "offline" and add a new connection status to reflect that, and then switch back to "online" if the connection shows signs of life. But since it's not a real state, just a heuristic, we'd still want to allow you to send activities and keep trying to listen.

Before considering such a thing we'd need unit tests for DLJS, which are currently sorely lacking.

from botframework-directlinejs.

justinwilaby avatar justinwilaby commented on July 19, 2024

I realize this is a very old thread but I came across this and thought I'd chime in. Of course there are APIs and Events that have existed for quite some time that tell you whether you're online or offline. It may be useful in this case at least for users that are implementing this in a browser like @nicksav

e.g.

window.addEventListener('offline', () => console.log('Aw snap!')
window.addEventListener('online', () => console.log('Yay!');

I hope this helps.

from botframework-directlinejs.

billba avatar billba commented on July 19, 2024

Oh hey that's cool, I didn't know that.

from botframework-directlinejs.

compulim avatar compulim commented on July 19, 2024

We are tracking the resume/end conversation stories at #124.

from botframework-directlinejs.

cwhitten avatar cwhitten commented on July 19, 2024

See #124 for updates on this workstream

from botframework-directlinejs.

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.