test.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset=utf-8 http-equiv="Content-Language" content="en"/>
  5. <link rel="stylesheet" type="text/css" href="test.css"/>
  6. <script type='text/javascript' src="/lws-common.js"></script>
  7. <script type='text/javascript' src='test.js'></script>
  8. <title>Minimal Websocket test app</title>
  9. </head>
  10. <body>
  11. <header></header>
  12. <article>
  13. <table><tr><td>
  14. <table width=600px>
  15. <tr>
  16. <td valign=middle align=center>
  17. <a href="https://libwebsockets.org">
  18. <img src="libwebsockets.org-logo.svg"></a></td><td>
  19. <section class="browser">
  20. <div id=brow>...</div></section>
  21. </td>
  22. <td width="64" height="64" id="wstransport"></td>
  23. <td width="64" height="64" id="transport"></td>
  24. </tr>
  25. </table>
  26. </td></tr>
  27. <tr><td colspan=2 align=center>
  28. Click <a href="leaf.jpg" target="_blank">Here</a> to
  29. have the test server send a big picture by http.
  30. </td></tr>
  31. <tr><td colspan=2>
  32. <div class="tabs">
  33. <div class="tab">
  34. <input type="radio" id="tab-1" name="tab-group-1" checked>
  35. <label for="tab-1">Dumb Increment Demo</label>
  36. <div class="content">
  37. <div id="dumb" class="group2">
  38. <table>
  39. <tr>
  40. <td id=wsdi_statustd align=center class="wsstatus">
  41. <span id=wsdi_status>Websocket connection not initialized
  42. </span></td>
  43. <td><span class="title">dumb increment-protocol</span></td>
  44. </tr>
  45. <tr>
  46. <td class="explain" colspan=2>
  47. The incrementing number is coming from the server at 20Hz and is individual for
  48. each connection to the server... try opening a second browser window.
  49. <br/><br/>
  50. The button sends a message over the websocket link to ask the server
  51. to zero just this connection's number.
  52. </td>
  53. </tr>
  54. <tr>
  55. <td align=center><div id=number class="bigger"> </div></td>
  56. <td align=center>
  57. <input type=button id=offset value="Reset counter">
  58. <input type=button id=junk value="Send junk">
  59. </td>
  60. </tr>
  61. </table>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="tab">
  66. <input type="radio" id="tab-2" name="tab-group-1">
  67. <label for="tab-2">Mirror Demo</label>
  68. <div class="content">
  69. <div id="mirror" class="group2">
  70. <table>
  71. <tr>
  72. <td colspan=1 id=wslm_statustd align=center class="wsstatus">
  73. <span id=wslm_status>Websocket connection not initialized</span>
  74. </td>
  75. <td>
  76. <span class="title">lws-mirror-protocol</span>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td colspan=2>
  81. <div class="explain">
  82. Use the mouse to draw on the canvas below -- all other browser windows open
  83. on this page see your drawing in realtime and you can see any of theirs as
  84. well.
  85. <br/><br/>
  86. The lws-mirror protocol doesn't interpret what is being sent to it, it just
  87. re-sends it to every other websocket it has a connection with using that
  88. protocol, including the guy who sent the packet.
  89. <br/><br/>
  90. <b>libwebsockets-test-client</b> joins in by spamming circles on to this
  91. shared canvas when run.
  92. </div>
  93. </td>
  94. </tr>
  95. <tr>
  96. <td colspan=2>Drawing color:
  97. <select id="color">
  98. <option value=#000000>Black</option>
  99. <option value=#0000ff>Blue</option>
  100. <option value=#20ff20>Green</option>
  101. <option value=#802020>Dark Red</option>
  102. </select>
  103. </tr>
  104. <tr>
  105. <td colspan=2 width=500 height=320>
  106. <div id="wslm_drawing" class="bgw"></div>
  107. </td>
  108. </tr>
  109. </table>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="tab">
  114. <input type="radio" id="tab-3" name="tab-group-1">
  115. <label for="tab-3">Close Testing</label>
  116. <div class="content">
  117. <div id="ot" class="group2">
  118. <table>
  119. <tr>
  120. <td>
  121. </td></tr>
  122. <tr><td id=ot_statustd align=center class="wsstatus">
  123. <span id=ot_status>Websocket connection not initialized</span>
  124. </td>
  125. <td colspan=2><span class="title">Open and close testing
  126. </span></td>
  127. </tr>
  128. <tr>
  129. <td class="explain" colspan=3 >
  130. To help with open and close testing, you can open and close a connection by
  131. hand using the buttons.<br>
  132. "<b>Close</b>" closes the connection from the browser with code 3000
  133. and reason 'Bye!".<br>
  134. "<b>Request Server Close</b>" sends a message asking the server to
  135. initiate the close, which it does with code 1001 and reason "Seeya".
  136. </td></tr>
  137. <tr>
  138. <td align=center>
  139. <input type="button" id="ot_open_btn" value="Open"></td>
  140. <td align=center>
  141. <input type="button" id="ot_close_btn" disabled value="Close" ></td>
  142. <td align=center>
  143. <input type="button" id="ot_req_close_btn" disabled
  144. value="Request Server Close" ></td>
  145. </tr>
  146. </table>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="tab">
  151. <input type="radio" id="tab-4" name="tab-group-1">
  152. <label for="tab-4">Server info</label>
  153. <div class="content">
  154. <div id="ot" class="group2">
  155. <table>
  156. <tr>
  157. <td id=s_statustd align=center class="wsstatus">
  158. <div id=s_status>Websocket connection not initialized</div>
  159. </td>
  160. <td colspan=1>
  161. <span class="title">Server Info</span>
  162. <input type=button id=pmd value="Test pmd">
  163. </td>
  164. </tr><tr>
  165. <td class="explain" colspan=2>
  166. This information is sent by the server over a ws[s] link and updated live
  167. whenever the information changes server-side.
  168. </td></tr>
  169. <tr>
  170. <td align=center colspan=2><div id=servinfo></div></td>
  171. </tr>
  172. <tr>
  173. <td align=center colspan=2><div id=conninfo class="conninfo"></div></td>
  174. </tr>
  175. </table>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="tab">
  180. <input type="radio" id="tab-5" name="tab-group-1">
  181. <label for="tab-5">POST</label>
  182. <div class="content">
  183. <div id="ot" class="group2">
  184. <table width=100%>
  185. <tr>
  186. <td colspan=1>
  187. <span class="title">POST Form testing</span>
  188. </td>
  189. </tr><tr>
  190. <td class="explain" colspan=2>
  191. This tests POST handling in lws.
  192. </td></tr>
  193. <tr>
  194. <td align=center colspan=2 class=tdform><div id=postinfo>
  195. FORM 1: send with urlencoded POST body args<br>
  196. <form action="formtest" method="post">
  197. <span class="f12">Some text: </span>
  198. <input type="text" name="text" value="Give me some text"><br>
  199. <input type="submit" name="send" value="Send the form">
  200. </form>
  201. </div></td>
  202. </tr>
  203. <tr>
  204. <td align=center colspan=2 class=tdform><div id=postinfo >
  205. FORM 2: send with multipart/form-data<br>
  206. (can handle file upload, test limited to 100KB)<br>
  207. <form name=multipart action="formtest" method="post"
  208. enctype="multipart/form-data">
  209. <span class="f12">Some text: </span>
  210. <input type="text" name="text" value="Give me some text">
  211. <br>
  212. <input type="file" name="file" id="file" size="20">&nbsp;
  213. <span id=file_info class="f12"></span><br>
  214. <input type="submit" id="upload" name="upload" disabled=1 value="Upload">
  215. </form>
  216. </div></td>
  217. </tr>
  218. </table>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </td></tr></table>
  224. Looking for support?
  225. <a href="https://libwebsockets.org">https://libwebsockets.org</a>,
  226. <a href="https://github.com/warmcat/libwebsockets">
  227. https://github.com/warmcat/libwebsockets</a></a><br/>
  228. Join the mailing list:
  229. <a href="https://libwebsockets.org/mailman/listinfo/libwebsockets">
  230. https://libwebsockets.org/mailman/listinfo/libwebsockets</a>
  231. </article>
  232. </body>
  233. </html>