Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: src/site/docs/dart-up-and-running/contents/ch05.html

Issue 453093005: Regeneration and redirects for book content (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 --- 1 ---
2 # WARNING: GENERATED FILE. DO NOT EDIT. 2 # WARNING: GENERATED FILE. DO NOT EDIT.
3 # WANT TO CONTRIBUTE? SEE https://github.com/dart-lang/dart-up-and-running-book 3 # WANT TO CONTRIBUTE? SEE https://github.com/dart-lang/dart-up-and-running-book
4 layout: book 4 layout: book
5 title: "Chapter 5. Walkthrough: Dartiverse Search from Dart: Up and Running" 5 title: "Chapter 5. Walkthrough: Dartiverse Search from Dart: Up and Running"
6 description: "Read Chapter 5. Walkthrough: Dartiverse Search of Dart: Up and Run ning, published by O'Reilly." 6 description: "Read Chapter 5. Walkthrough: Dartiverse Search of Dart: Up and Run ning, published by O'Reilly."
7 --- 7 ---
8 <div class="navheader"><table width="100%" summary="Navigation header"><tr><th c olspan="3" align="center">Chapter 5. Walkthrough: Dartiverse Search</th></tr><tr ><td width="20%" align="left"><a accesskey="p" href="ch04-summary.html">Prev</a>  </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a acc esskey="n" href="colophon.html">Next</a></td></tr></table><hr></div><div class=" chapter"><div class="titlepage"><div><div><h1 class="title"><a name="ch05"></a>C hapter 5. Walkthrough: Dartiverse Search</h1></div></div></div><div class="toc"> <p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href=" ch05.html#ch05-how-to-run">How to Run Dartiverse Search</a></span></dt><dt><span class="sect1"><a href="ch05.html#ch05-how-it-works">How Dartiverse Search Works </a></span></dt><dt><span class="sect1"><a href="ch05.html#ch05-client-html">The Client's HTML Code</a></span></dt><dt><span class="sect1"><a href="ch05.html#ch 05-client-dart">The Client's Dart Code</a></span></dt><dd><dl><dt><span class="s ect2"><a href="ch05.html#ch05-client-dart-find-elements">Finding DOM Elements</a ></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-client-dart-handle- events">Handling Events</a></span></dt><dt><span class="sect2"><a href="ch05.htm l#ch05-client-dart-properties">Getting and Setting Properties</a></span></dt><dt ><span class="sect2"><a href="ch05.html#ch05-client-dart-add-elements">Adding DO M Elements</a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-client -dart-json">Encoding and Decoding Messages</a></span></dt><dt><span class="sect2 "><a href="ch05.html#ch05-client-dart-web-sockets">Communicating with WebSockets </a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05.html#ch05-server ">The Server's Code</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05 .html#ch05-server-static">Serving Static Files</a></span></dt><dt><span class="s ect2"><a href="ch05.html#ch05-server-web-socket">Managing WebSocket Connections< /a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-server-web-apis"> Using Web APIs</a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-se rver-library">Implementing a Library</a></span></dt><dt><span class="sect2"><a h ref="ch05.html#ch05-server-logging">Logging Messages</a></span></dt></dl></dd><d t><span class="sect1"><a href="ch05.html#ch05-what-next">What Next?</a></span></ dt></dl></div><p>This chapter points out some of the useful and fun features of the 8 <div class="navheader"><table width="100%" summary="Navigation header"><tr><th c olspan="3" align="center">Chapter 5. Walkthrough: Dartiverse Search</th></tr><tr ><td width="20%" align="left"><a accesskey="p" href="ch04-summary.html">Prev</a>  </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a acc esskey="n" href="colophon.html">Next</a></td></tr></table><hr></div><div class=" chapter"><div class="titlepage"><div><div><h1 class="title"><a name="ch05"></a>C hapter 5. Walkthrough: Dartiverse Search</h1></div></div></div><div class="toc"> <p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href=" ch05.html#ch05-how-to-run">How to Run Dartiverse Search</a></span></dt><dt><span class="sect1"><a href="ch05.html#ch05-how-it-works">How Dartiverse Search Works </a></span></dt><dt><span class="sect1"><a href="ch05.html#ch05-client-html">The Client's HTML Code</a></span></dt><dt><span class="sect1"><a href="ch05.html#ch 05-client-dart">The Client's Dart Code</a></span></dt><dd><dl><dt><span class="s ect2"><a href="ch05.html#ch05-client-dart-find-elements">Finding DOM Elements</a ></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-client-dart-handle- events">Handling Events</a></span></dt><dt><span class="sect2"><a href="ch05.htm l#ch05-client-dart-properties">Getting and Setting Properties</a></span></dt><dt ><span class="sect2"><a href="ch05.html#ch05-client-dart-add-elements">Adding DO M Elements</a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-client -dart-json">Encoding and Decoding Messages</a></span></dt><dt><span class="sect2 "><a href="ch05.html#ch05-client-dart-web-sockets">Communicating with WebSockets </a></span></dt></dl></dd><dt><span class="sect1"><a href="ch05.html#ch05-server ">The Server's Code</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch05 .html#ch05-server-static">Serving Static Files</a></span></dt><dt><span class="s ect2"><a href="ch05.html#ch05-server-web-socket">Managing WebSocket Connections< /a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-server-web-apis"> Using Web APIs</a></span></dt><dt><span class="sect2"><a href="ch05.html#ch05-se rver-library">Implementing a Library</a></span></dt><dt><span class="sect2"><a h ref="ch05.html#ch05-server-logging">Logging Messages</a></span></dt></dl></dd><d t><span class="sect1"><a href="ch05.html#ch05-what-next">What Next?</a></span></ dt></dl></div><p>This chapter points out some of the useful and fun features of the
9 Dart language and libraries that are used in Dartiverse Search, a 9 Dart language and libraries that are used in Dartiverse Search, a
10 client-server app. As <a class="xref" href="ch05.html#DartiverseScreenshot" ti tle="Figure 5.1. The client app UI">Figure 5.1, “The client app UI”</a> shows, 10 client-server app. As <a class="xref" href="ch05.html#DartiverseScreenshot" ti tle="Figure 5.1. The client app UI">Figure 5.1, “The client app UI”</a> shows,
11 Dartiverse Search looks for a user-entered string in GitHub and 11 Dartiverse Search looks for a user-entered string in GitHub and
12 StackOverflow. The app is asynchronous, adding results as they're found, so 12 StackOverflow. The app is asynchronous, adding results as they're found, so
13 the UI is always responsive.</p><div class="figure"><a name="DartiverseScreens hot"></a><p class="title"><b>Figure 5.1. The client app UI</b></p><div class="fi gure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="NaN"><tr>< td><img src="figs/web/daur_0501.png" width="NaN" alt="The client app UI"></td></ tr></table></div></div></div><br class="figure-break"><div class="sect1"><div cl ass="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ch05-ho w-to-run"></a>How to Run Dartiverse Search</h2></div></div></div><p>You can use Dart Editor to get and run Dartiverse Search.</p><div class="orderedlist"><ol cl ass="orderedlist" type="1"><li class="listitem"><p>In Dart Editor, go to the Wel come page. (If you don't see it, 13 the UI is always responsive.</p><div class="figure"><a name="DartiverseScreens hot"></a><p class="title"><b>Figure 5.1. The client app UI</b></p><div class="fi gure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="NaN"><tr>< td><img src="figs/web/daur_0501.png" width="NaN" alt="The client app UI"></td></ tr></table></div></div></div><br class="figure-break"><div class="sect1"><div cl ass="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ch05-ho w-to-run"></a>How to Run Dartiverse Search</h2></div></div></div><p>You can use Dart Editor to get and run Dartiverse Search.</p><div class="orderedlist"><ol cl ass="orderedlist" type="1"><li class="listitem"><p>In Dart Editor, go to the Wel come page. (If you don't see it,
14 choose <span class="bold"><strong>Tools &gt; Welcome 14 choose <span class="bold"><strong>Tools &gt; Welcome
15 Page</strong></span>.)</p></li><li class="listitem"><p>In the demo secti on, click <span class="bold"><strong>Dartiverse 15 Page</strong></span>.)</p></li><li class="listitem"><p>In the demo secti on, click <span class="bold"><strong>Dartiverse
16 Search</strong></span> to create a copy of the dartiverse_search 16 Search</strong></span> to create a copy of the dartiverse_search
17 package.<a href="#ftn.idm244197742832" class="footnote" name="idm2441977 42832"><sup class="footnote">[2]</sup></a></p></li><li class="listitem"><p>Use < span class="bold"><strong>Tools &gt; Pub Build</strong></span> to 17 package.<a href="#ftn.idm121378695232" class="footnote" name="idm1213786 95232"><sup class="footnote">[2]</sup></a></p></li><li class="listitem"><p>Use < span class="bold"><strong>Tools &gt; Pub Build</strong></span> to
18 build the package.</p></li><li class="listitem"><p>Select <code class="l iteral">bin/server.dart</code> and click the 18 build the package.</p></li><li class="listitem"><p>Select <code class="l iteral">bin/server.dart</code> and click the
19 <span class="bold"><strong>Run</strong></span> button. You should see a message 19 <span class="bold"><strong>Run</strong></span> button. You should see a message
20 that the search server is running at http://127.0.0.1:9223/.</p></li><li class="listitem"><p>Click that URL or enter it into any modern browser. The sea rch 20 that the search server is running at http://127.0.0.1:9223/.</p></li><li class="listitem"><p>Click that URL or enter it into any modern browser. The sea rch
21 client UI should appear in your default browser.</p></li></ol></div></di v><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="c lear: both"><a name="ch05-how-it-works"></a>How Dartiverse Search Works</h2></di v></div></div><p>The search server is an HTTP server that provides a WebSocket 21 client UI should appear in your default browser.</p></li></ol></div></di v><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="c lear: both"><a name="ch05-how-it-works"></a>How Dartiverse Search Works</h2></di v></div></div><p>The search server is an HTTP server that provides a WebSocket
22 interface. The search client uses that WebSocket interface as a 22 interface. The search client uses that WebSocket interface as a
23 bi-directional communication channel with the server. The client sends 23 bi-directional communication channel with the server. The client sends
24 search requests to the server over the WebSocket, and the server replies 24 search requests to the server over the WebSocket, and the server replies
25 with any results and then a final, "search done" message.</p><p>The server s tarts things off by binding to localhost, port 9223, and 25 with any results and then a final, "search done" message.</p><p>The server s tarts things off by binding to localhost, port 9223, and
26 listening for requests to the WebSocket: 26 listening for requests to the WebSocket:
27 <code class="literal">ws://127.0.0.1:9223/ws</code>. Search clients can conn ect 27 <code class="literal">ws://127.0.0.1:9223/ws</code>. Search clients can conn ect
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 warnings to appear, you can set the level to 353 warnings to appear, you can set the level to
354 <code class="literal">Level.WARNING</code>.</p><p>For a list of all the le vels and what they mean, see the <a class="ulink" href="https://api.dartlang.org /logging/Level.html" target="_top">Level API 354 <code class="literal">Level.WARNING</code>.</p><p>For a list of all the le vels and what they mean, see the <a class="ulink" href="https://api.dartlang.org /logging/Level.html" target="_top">Level API
355 documentation.</a> See the <a class="ulink" href="https://api.dartlang.org /logging/Logger.html" target="_top">Logger API 355 documentation.</a> See the <a class="ulink" href="https://api.dartlang.org /logging/Logger.html" target="_top">Logger API
356 documentation</a> for a list of methods that log messages.</p></div></div> <div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="cle ar: both"><a name="ch05-what-next"></a>What Next?</h2></div></div></div><p>You’v e seen how the Dartiverse Search sample uses both server-side 356 documentation</a> for a list of methods that log messages.</p></div></div> <div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="cle ar: both"><a name="ch05-what-next"></a>What Next?</h2></div></div></div><p>You’v e seen how the Dartiverse Search sample uses both server-side
357 and client-side Dart code to implement a web app. It makes use of both 357 and client-side Dart code to implement a web app. It makes use of both
358 built-in libraries and libraries from packages published on 358 built-in libraries and libraries from packages published on
359 pub.dartlang.org.</p><p>If you'd like to continue exploring Dartiverse Searc h, consider 359 pub.dartlang.org.</p><p>If you'd like to continue exploring Dartiverse Searc h, consider
360 improving its user interface or adding another search engine. If you'd 360 improving its user interface or adding another search engine. If you'd
361 like to look at other samples, you can find them in Dart Editor and at 361 like to look at other samples, you can find them in Dart Editor and at
362 <a class="ulink" href="http://dartlang.org/samples" target="_top">http://dar tlang.org/samples</a>.</p><p>Our website has lots more information, including gu ides and 362 <a class="ulink" href="http://dartlang.org/samples" target="_top">http://dar tlang.org/samples</a>.</p><p>Our website has lots more information, including gu ides and
363 tutorials. It's all at <a class="ulink" href="http://dartlang.org" target="_ top">http://dartlang.org</a>.</p></div><div class="footnotes"><br><hr style="wid th:100; text-align:left;margin-left: 0"><div id="ftn.idm244197742832" class="foo tnote"><p><a href="#idm244197742832" class="para"><sup class="para">[2] </sup></ a>If you aren’t using Dart Editor, you can find the Dartiverse 363 tutorials. It's all at <a class="ulink" href="http://dartlang.org" target="_ top">http://dartlang.org</a>.</p></div><div class="footnotes"><br><hr style="wid th:100; text-align:left;margin-left: 0"><div id="ftn.idm121378695232" class="foo tnote"><p><a href="#idm121378695232" class="para"><sup class="para">[2] </sup></ a>If you aren’t using Dart Editor, you can find the Dartiverse
364 Search source code in the <a class="ulink" href="http://code.google. com/p/dart" target="_top">Dart project</a> under 364 Search source code in the <a class="ulink" href="http://code.google. com/p/dart" target="_top">Dart project</a> under
365 <code class="filename">samples/dartiverse_search</code>.</p></div></ div></div><div class="navfooter"><hr><table width="100%" summary="Navigation foo ter"><tr><td width="40%" align="left"><a accesskey="p" href="ch04-summary.html"> Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right" > <a accesskey="n" href="colophon.html">Next</a></td></tr><tr><td width="40%" al ign="left" valign="top">Summary </td><td width="20%" align="center"><a accesskey ="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">  Colophon</td></tr></table></div> 365 <code class="filename">samples/dartiverse_search</code>.</p></div></ div></div><div class="navfooter"><hr><table width="100%" summary="Navigation foo ter"><tr><td width="40%" align="left"><a accesskey="p" href="ch04-summary.html"> Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right" > <a accesskey="n" href="colophon.html">Next</a></td></tr><tr><td width="40%" al ign="left" valign="top">Summary </td><td width="20%" align="center"><a accesskey ="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">  Colophon</td></tr></table></div>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698