Challenge Overview
Welcome to the ElectronJs Http Preconnect Fix
Challenge Objectives
- In this project we are aiming to fix one issue of the Electron App that doesn't support HTTP Preconnect. A useful resource to understand preconnect is here https://www.keycdn.com/blog/resource-hints.
- This will be the last of the series of challenges to update the ElectronJs s
Challenge Background
- Our client make use Electron for one of their internal applications.
- It has requested Topcoder to help resolve a preconnect issue for the core Electron project owned by the open-source community.
Technology Stack
- C/C++
- Javascript
Individual Requirements
1. You will need to provide a solution for the HTTP preconnect issue to be incorporated into Electron (https://electronjs.org) source code. The issue is described in Github - https://github.com/electron/electron/issues/16476
2. An intial solution will be provided in forum. However, we advise to use this repository https://github.com/coderReview/electron (master branch) as starting point as it's already merged with lastest master branch and has also a Lint fix. The solution is not guaranteed to work and must be updated to meet the specifications detailed below.
3. The fix should cover the following requirements:
- When a page provides a preconnect resource hint via a response header or link tag, it should preemptively preconnect to the specified domain
- When loading a page that hasn't been seen before, it should preemptively open 2 connections to the origin
- When loading a page that has been seen before, it may use collected data from previous visits to preemptively open however many connections it believes are likely to be necessary
- The main goal is that we are able to preconnect the maximum number (6) of HTTP connections.
- We are concerned that due to a recent change in Chromium 66, the learning behaviour based on previous visits now works differently and is not going to be sufficient to meet this goal.
- Should that prove to be the case, we would like an explicit option we can use in Electron to request preconnects instead of the learning behaviour. This should be a new option for the BrowserWindow constructor or its loadURL method
4. Electron coding style should be followed https://electronjs.org/docs/development/coding-style and npm run lint must pass
5. Winner will be asked to update the PR https://github.com/electron/electron/pull/17487.
Acceptance criteria
HTTP Preconnect must work.
The best solution may be by having an Electron API for specifically requesting preconnects, however we are open about whether this is done by making the Chromium feature available.
1. A test application running within Electron should be able to have the maximum number(6) of HTTP connections preconnected
2. Adequate test/example cases must be provided to demonstrate that the solution works by:
- Explicit option for Electron BrowserWindow (should it prove necessary to achieve 6 connections): a standalone example is provided as an example of usage
- Making the underlying Chromium behaviour available: the reproduction cases on the GitHub issue are solved
3. The source code must be optimized following the best practices of the Electron architecture and well documented
Final Submission Guidelines
- Patch to the ElectronJs repository
- Deployment and Validation Guide
- Test cases