Skip to content

Commit

Permalink
deploy: 7abbbfd
Browse files Browse the repository at this point in the history
  • Loading branch information
mariospr committed Jan 31, 2024
1 parent 0e91acb commit a8c602e
Show file tree
Hide file tree
Showing 22 changed files with 588 additions and 312 deletions.
2 changes: 1 addition & 1 deletion use-case-ssrendering/.stamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Wed Jan 31 11:47:07 UTC 2024
Wed Jan 31 12:56:11 UTC 2024
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/a-good-choice.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/architecture.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/builds.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/get-wpe.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="learn">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/supported-hardware.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
2 changes: 1 addition & 1 deletion use-case-ssrendering/about/what-is-embedded.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.258Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.703Z">
<meta property="article:tag" content="about">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 22 additions & 52 deletions use-case-ssrendering/blog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,30 @@
<description>News related to WPE WebKit.</description>
<link href="https://wpewebkit.org/blog.xml" rel="self"/>
<link href="https://wpewebkit.org/blog/"/>
<updated>2024-01-29T06:00:00Z</updated>
<updated>2024-02-01T00:00:00Z</updated>
<id>https://wpewebkit.org/blog/</id>

<entry>
<title>Use Case: Server-side headless rendering</title>
<link href="https://wpewebkit.org/wpewebkit.org/use-case-ssrendering/blog/2024-use-case-server-side-rendering.html"/>
<updated>2024-02-01T00:00:00Z</updated>
<id>https://wpewebkit.org/wpewebkit.org/use-case-ssrendering/blog/2024-use-case-server-side-rendering.html</id>
<content type="html">&lt;div class=&quot;success-top&quot;&gt;
&lt;img alt=&quot;WPE and server-side headless rendering&quot; align=&quot;center&quot; src=&quot;https://wpewebkit.org/assets/img/logo-server-side-rendering.png&quot; srcset=&quot;https://wpewebkit.org/assets/img/[email protected] 2x&quot; /&gt;
&lt;img alt=&quot;WPE&quot; align=&quot;center&quot; src=&quot;https://wpewebkit.org/assets/img/logo-blue.svg&quot; /&gt;
&lt;/div&gt;
&lt;p&gt;In many distributed applications, it can be useful to run a light web browser on the server side to render some HTML content or process images, video and/or audio using javascript.&lt;/p&gt;
&lt;p&gt;Some concrete use-cases can be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Video post-production using HTML overlays.&lt;/li&gt;
&lt;li&gt;Easy 3D rendering with WebGL that can be broadcasted as a video stream.&lt;/li&gt;
&lt;li&gt;Reusing the same javascript code between a frontend web application and the backend processing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;WPE WebKit is the perfect solution for all those use cases as it offers a lightweight solution which can run on low-end hardware or even within a container. It provides a lot of flexibility at the moment of choosing the backend infrastructure as WPE WebKit can, for instance, run from within a container with a very minimal Linux configuration (no need for any windowing system) and with full hardware acceleration and zero-copy of the video buffers between the GPU and the CPU.&lt;/p&gt;
&lt;p&gt;Additionally, the fact that WPE WebKit is optimized for lower-powered devices, makes it also the perfect option for server-side rendering when scaling commercial deployments while keeping cost under control, which is yet another important factor to take into account when considering cloud rendering.&lt;/p&gt;
</content>
</entry>

<entry>
<title>A New WPE Backend Using EGLStream</title>
<link href="https://wpewebkit.org/wpewebkit.org/use-case-ssrendering/blog/07-creating-wpe-backends.html"/>
Expand Down Expand Up @@ -849,57 +870,6 @@ Note that these implementations are already complete in LBSE downstream and do n
&lt;p&gt;WPE WebKit brought &lt;strong&gt;RDK (Reference Design Kit)&lt;/strong&gt;, a modern, performant web browser, to millions of screens. It enables operators to manage devices and easily customize their UIs and apps and provides analytics to improve the customer experience and drive business results.&lt;/p&gt;
&lt;p&gt;Delivering a fast and memory-efficient browser for embedded systems is a challenging task, so Igalia helped Metrological build a new full-screen browser engine which stripped away all unnecessary toolkit elements.&lt;/p&gt;
&lt;p&gt;With years of experience around WebKit platform integration, Igalia worked to produce a new WebKit port, WPE, which interfaced directly with Wayland and the graphics driver. Additionally, Igalia pushed forward the implementation of a multi-platform multi-threaded compositor, enabling better performance on low-end multicore processors. WPE is an official port of WebKit.&lt;/p&gt;
</content>
</entry>

<entry>
<title>WPE Networking Overview</title>
<link href="https://wpewebkit.org/wpewebkit.org/use-case-ssrendering/blog/04-wpe-networking-overview.html"/>
<updated>2022-09-29T00:00:00Z</updated>
<id>https://wpewebkit.org/wpewebkit.org/use-case-ssrendering/blog/04-wpe-networking-overview.html</id>
<content type="html">&lt;p&gt;At the heart of any browser engine is networking: Connecting with services and other users. Unlike other engines, WebKit approaches this more abstractly by leaving a large portion of the networking up to individual ports. This includes network protocols such as HTTP, WebSockets, and WebRTC. The upside to this approach is a higher level of integration with the system-provided libraries and features so WebKit will behave similarly to other software on the platform often with more centralized configuration.&lt;/p&gt;
&lt;p&gt;Due to this abstraction there are a few independent layers that make up the networking stack of WPE. In this post, I’ll break down what each layer accomplishes as well as give some insight into the codebase’s structure.&lt;/p&gt;
&lt;h2 id=&quot;networking-layers&quot; tabindex=&quot;-1&quot;&gt;Networking Layers&lt;/h2&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img alt=&quot;WebKit Network Layers&quot; src=&quot;https://wpewebkit.org/assets/networking-layers.svg&quot; /&gt;
&lt;/div&gt;
&lt;h3 id=&quot;webkit&quot; tabindex=&quot;-1&quot;&gt;WebKit&lt;/h3&gt;
&lt;p&gt;Before we get into the libraries used for WPE, let’s discuss WebKit itself. Despite abstracting out a lot of the protocol handling, WebKit itself still needs to understand a lot of fundamentals of HTTP.&lt;/p&gt;
&lt;p&gt;WebCore (discussed in &lt;a href=&quot;https://wpewebkit.org/blog/02-overview-of-wpe.html&quot;&gt;WPE Overview&lt;/a&gt;) understands HTTP requests, headers, and cookies, as they are required to implement many higher-level features. What it does not do is the network operations, most parsing, or on-disk storage. In the codebase, these are represented by &lt;code&gt;ResourceRequest&lt;/code&gt; and &lt;code&gt;ResourceResponse&lt;/code&gt; objects, which map to general HTTP functionality.&lt;/p&gt;
&lt;h4 id=&quot;networkprocess&quot; tabindex=&quot;-1&quot;&gt;NetworkProcess&lt;/h4&gt;
&lt;p&gt;A core part of modern web engine security is the multi-process model. In order to defend against exploits, each website runs in its own isolated process that does not have network access. In order to allow for network access, they must talk over IPC to a dedicated NetworkProcess, typically one per browser instance. The NetworkProcess receives a &lt;code&gt;ResourceRequest&lt;/code&gt;, creates a &lt;code&gt;NetworkDataTask&lt;/code&gt; with it to download the data, and responds with a &lt;code&gt;ResourceResponse&lt;/code&gt; to the WebProcess which looks like this:&lt;/p&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;img alt=&quot;WebKit Network Flowchart&quot; src=&quot;https://wpewebkit.org/assets/networking-flow.svg&quot; /&gt;
&lt;/div&gt;
&lt;h3 id=&quot;wpe&quot; tabindex=&quot;-1&quot;&gt;WPE&lt;/h3&gt;
&lt;p&gt;WPE implements the platform-specific versions of the classes above as &lt;code&gt;ResourceRequestSoup&lt;/code&gt; and &lt;code&gt;NetworkDataTaskSoup&lt;/code&gt;, primarily using a library called libsoup.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://libsoup.org/&quot;&gt;libsoup&lt;/a&gt; library was originally created for the GNOME project’s email client and has since grown to be a very featureful HTTP implementation, now maintained by Igalia.&lt;/p&gt;
&lt;p&gt;At a high level, the main task that libsoup does is manage connections and queued requests to websites and then efficiently streams the responses back to WPE. Properly implementing HTTP is a fairly large task, and this is a non-exhaustive list of features it implements: HTTP/1.1, HTTP/2, WebSockets, cookies, decompression, multiple authentication standards, HSTS, and HTTP proxies.&lt;/p&gt;
&lt;p&gt;On its own, libsoup is really focused on the HTTP layer and uses the &lt;a href=&quot;https://gitlab.gnome.org/GNOME/glib&quot;&gt;GLib&lt;/a&gt; library to implement many of its networking features in a portable way. This is where TCP, DNS, and TLS are handled. It is also directly used by WebKit for URI parsing and DNS pre-caching.&lt;/p&gt;
&lt;p&gt;Using GLib also helps standardize behavior across modern Linux systems. It allows configuration of a global proxy resolver that WebKit, along with other applications, can use.&lt;/p&gt;
&lt;h4 id=&quot;tls&quot; tabindex=&quot;-1&quot;&gt;TLS&lt;/h4&gt;
&lt;p&gt;Another unique detail of our stack is that TLS is fully abstracted inside of GLib by a project called &lt;a href=&quot;https://gitlab.gnome.org/GNOME/glib-networking&quot;&gt;GLib-Networking&lt;/a&gt;. This project provides multiple implementations of TLS that can be chosen at runtime, including OpenSSL and gnutls on Linux. The benefit here is that clients can choose the implementation they prefer—whether for licensing, certification, or technical reasons.&lt;/p&gt;
&lt;h3 id=&quot;usage&quot; tabindex=&quot;-1&quot;&gt;Usage&lt;/h3&gt;
&lt;p&gt;Let’s go step by step to see some real world usage. If we call &lt;code&gt;webkit_web_view_load_uri()&lt;/code&gt; for a new domain it will:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;ResourceRequest&lt;/code&gt; in WebCore that represents an HTTP request with a few basic headers set.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ResourceRequestSoup&lt;/code&gt; will create its own internal representation for the request using &lt;code&gt;soup_message_new_for_uri()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;This is passed to the &lt;code&gt;NetworkProcess&lt;/code&gt; to load this request as a &lt;code&gt;NetworkDataTask&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NetworkDataTaskSoup&lt;/code&gt; will send/receive the request/response with &lt;code&gt;soup_session_send()&lt;/code&gt; which queues the message to be sent.&lt;/li&gt;
&lt;li&gt;libsoup will connect to the host using &lt;code&gt;GSocketClient&lt;/code&gt; which does a DNS lookup and TCP connection.
&lt;ul&gt;
&lt;li&gt;If this is a TLS connection &lt;code&gt;GTlsClientConnection&lt;/code&gt; will use a library such as gnutls to do a TLS handshake.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;libsoup will write the HTTP request and read from the socket parsing the HTTP responses eventually returning the data to WebKit.&lt;/li&gt;
&lt;li&gt;WebKit receives this data, along with periodic updates about the state of the request, and sends it out of the &lt;code&gt;NetworkProcess&lt;/code&gt; back to the main process as a &lt;code&gt;ResourceResponse&lt;/code&gt; eventually loading the data in the &lt;code&gt;WebProcess&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;summary&quot; tabindex=&quot;-1&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;In conclusion, WebKit provides a very flexible abstraction for platforms, and WPE leverages mature system libraries to provide a portable implementation. It has many layers, but they are all well organized and suited to their tasks.&lt;/p&gt;
&lt;p&gt;If you are working with WPE and are interested in collaborating, feel free to &lt;a href=&quot;https://www.igalia.com/contact/&quot;&gt;contact us&lt;/a&gt;. If you are interested in working with Igalia, you can &lt;a href=&quot;https://www.igalia.com/jobs/browsers_webkit_position&quot;&gt;apply here&lt;/a&gt;.&lt;/p&gt;
</content>
</entry>
</feed>
7 changes: 6 additions & 1 deletion use-case-ssrendering/blog/1/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<meta property="og:image:width" content="400">
<meta property="og:image:height" content="400">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2024-01-31T11:46:34.330Z">
<meta property="article:published_time" content="2024-01-31T12:56:01.775Z">
<meta property="article:tag" content="blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@WPEWebKit">
Expand Down Expand Up @@ -116,6 +116,11 @@ <h1>Blog</h1>
</header>
<div class="card">
<ol reversed="" role="list" class="w-list-unstyled" style="margin: 1rem 0 1rem 0; list-style: none;"><li class="listitem">
<img src="/wpewebkit.org/use-case-ssrendering/assets/networking-layers.svg" alt="">
<time>Sep 29, 2022</time>
<h3><a href="/wpewebkit.org/use-case-ssrendering/blog/04-wpe-networking-overview.html">WPE Networking Overview</a></h3>
<p>In this post we'll cover the many layers of the networking stack that WPE uses including libsoup and glib.</p>
</li><li class="listitem">
<img src="/wpewebkit.org/use-case-ssrendering/assets/build-webkit-org-screenshot.png" alt="">
<time>Jul 28, 2022</time>
<h3><a href="/wpewebkit.org/use-case-ssrendering/blog/04-wpe-qa-tooling.html">WPE QA and tooling</a></h3>
Expand Down
Loading

0 comments on commit a8c602e

Please sign in to comment.