<chapter id="gtk-broadway">
  <title>Using GTK with Broadway</title>
  <para>
    The GDK Broadway backend provides support for displaying GTK
    applications in a web browser, using HTML5 and web sockets. To run
    your application in this way, select the Broadway backend by setting
    <literal>GDK_BACKEND=broadway</literal>. Then you can make your
    application appear in a web browser by pointing it at
    <literal>http://127.0.0.1:8080</literal>. Note that you need to
    enable web sockets in your web browser.
  </para>
  <para>
    You can choose a different port from the default 8080 by setting the
    <literal>BROADWAY_DISPLAY</literal> environment variable to the port
    that you want to use.
  </para>
  <para>
    It is also possible to use multiple GTK applications in the same web
    browser window, by using the Broadway server,
    <literal>broadwayd</literal>, that ships with GTK. To use broadwayd,
    start it like this:
  </para>
  <programlisting>
broadwayd :5
</programlisting>
  <para>
    Then point your web browser at
    <literal>http://127.0.0.1:8085</literal>. Start your applications
    like this:
  </para>
  <programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
</programlisting>
  <sect1 id="broadway-envar">
    <title>Broadway-specific environment variables</title>
    <sect2>
      <title>BROADWAY_DISPLAY</title>
      <para>
        Specifies the Broadway display number. The default display is 0.
        The display number determines the port to use when connecting to
        a Broadway application via the following formula:
        <literal>port = 8080 + display</literal>
      </para>
    </sect2>
  </sect1>
</chapter>
