Skip to content

Conversation

@acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented Apr 21, 2020

The packager implements a websocket that allows apps to be recieve commands from the packager. Two obvious commands are 'reload' and 'show devmenu'.

This PR makes the instance connect to this websocket and see the commands. It hooks up reload. The dev menu command is left as a todo for now, as the dev menu is currently tied to the root view, which is probably incorrect and will require some more refactoring.

Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms requested a review from a team as a code owner April 21, 2020 21:09
auto response =
std::string(Microsoft::Common::Utilities::CheckedReinterpretCast<char *>(data.data()), data.size());
auto json =
winrt::Windows::Data::Json::JsonObject::Parse(Microsoft::Common::Unicode::Utf8ToUtf16(response));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use folly::parseJSON here instead but this is fine too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to avoid adding extra folly usage, since long term once we are off the legacy bridge, we might be able to ditch folly altogether.

@acoates-ms acoates-ms added the AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity) label Apr 22, 2020
@ghost
Copy link

ghost commented Apr 22, 2020

Hello @acoates-ms!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 2fad67b into microsoft:master Apr 22, 2020
DownloadFromAsync(facebook::react::DevServerHelper::get_LaunchDevToolsCommandUrl(settings.debugHost)).get();
}

std::future<void> DevSupportManager::CreatePackagerConnection(const facebook::react::DevSettings &settings) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::future [](start = 0, length = 17)

Is it possible to avoid using the std::future? It does not offer a continuation. The only way to observe it is to block a thread which is an anti-pattern.
It is better to use either IAsyncAction or Mso::Future.

#ifdef DEFAULT_CPPWINRT_EXCEPTIONS
co_await async;
#else
co_await lessthrow_await_adapter<winrt::Windows::Foundation::IAsyncAction>{async};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. What does this do?
  2. Any reason this is using std::future instead of winrt::fire_and_forget as some other code does?


try {
LaunchDevTools(settings);
CreatePackagerConnection(settings);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreatePackagerConnection [](start = 4, length = 24)

Why do we ignore the result?
Would it be better to have a sequence of async actions uisng .Then or co_await?

@acoates-ms acoates-ms deleted the packagerreload branch May 21, 2020 17:16
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge Causes a PR to be automatically merged once all requirements are passed (label drives bot activity)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants