microsoft / microsoft/BotFramework-WebChat

Dev notes: Pop out experience

Open
#4,687 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Background

Investigates if how we can offer a pop out experience. It should provide continuity when used with non-SPA.

Notes

Potentially, we could offer pop out experience by using SharedWorker, which is supported by Safari 16.

Lifetime of SharedWorker object is based on all references. If there are at least one webpage referencing the SharedWorker, then the worker will be alive. Reference is removed on page navigation.

If the user pop out Web Chat before page navigation, they can preserve the connection. They can also pop Web Chat back into the page. However, if they did not pop out and navigate to another page, the worker will be closed.

Currently, there are 2 paths: sharing DirectLineJS object, sharing Redux store.

Sharing DirectLineJS object

Observable is not a trivial interface. However, this is technically possible, it's just complex.

DirectLineJS object is event-based. Despite being a singleton, chat history is not restored on new instance of Web Chat because events related to former activities were gone/lost.

That means, when popping out Web Chat, the new web page will lose the chat history.

Sharing Redux store

We can host Redux store in Worker/SharedWorker relatively easy, thanks to simple Store interface. The only requirement is createStore must be an asynchronous function. This is because the worker needs to send the initial state and this is asynchronous.

However, in Web Chat, some of the Redux actions (say, DIRECT_LINE/CONNECT) contains objects that are not serializable. Thus, actions cannot be dispatched across the boundary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; start by comparing the proposed SharedWorker approach with the DirectLineJS and Redux sharing paths described. A concrete implementation scope and acceptance criteria for preserving and restoring Web Chat across navigation are still needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, redux
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.