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