blob: f4b89a73ad814bd289e8e2f045cd661c8b967a4a [file] [log] [blame]
Andy Green775c0dd2010-10-29 14:15:22 +01001<!DOCTYPE html>
2<html lang="en">
3<head>
Andy Greenc51823a2013-01-31 19:50:57 +08004 <meta charset=utf-8 http-equiv="Content-Language" content="en"/>
Andy Green97f3e662018-08-25 07:22:36 +08005 <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 Greenab7d9332010-11-11 13:19:19 +00008 <title>Minimal Websocket test app</title>
Andy Green775c0dd2010-10-29 14:15:22 +01009</head>
10
11<body>
Andy Greenc51823a2013-01-31 19:50:57 +080012<header></header>
13<article>
Andy Greenab7d9332010-11-11 13:19:19 +000014
Andy Greenc51823a2013-01-31 19:50:57 +080015<table><tr><td>
16
Andy Greenaa850242016-02-20 07:52:35 +080017<table width=600px>
18 <tr>
19 <td valign=middle align=center>
20 <a href="https://libwebsockets.org">
Andy Greend9f982a2018-11-19 07:40:47 +080021 <img src="libwebsockets.org-logo.svg"></a></td><td>
Andy Greena4161782018-03-22 07:44:02 +080022 <section class="browser">
Andy Greenaa850242016-02-20 07:52:35 +080023 <div id=brow>...</div></section>
24 </td>
Andy Greena4161782018-03-22 07:44:02 +080025 <td width="64" height="64" id="wstransport"></td>
26 <td width="64" height="64" id="transport"></td>
Andy Greenaa850242016-02-20 07:52:35 +080027 </tr>
Andy Greenc51823a2013-01-31 19:50:57 +080028
Andy Greenfe2a0d22010-11-12 13:10:40 +000029</table>
Andy Greenaa850242016-02-20 07:52:35 +080030</td></tr>
31<tr><td colspan=2 align=center>
Andy Greend459a6f2016-04-08 18:30:45 +080032Click <a href="leaf.jpg" target="_blank">Here</a> to
Andy Greenaa850242016-02-20 07:52:35 +080033have 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 Green0ad1a6e2016-02-20 14:05:55 +080044 <table>
45 <tr>
46 <td id=wsdi_statustd align=center class="wsstatus">
Andy Green97f3e662018-08-25 07:22:36 +080047 <span id=wsdi_status>Websocket connection not initialized
48 </span></td>
Andy Green0ad1a6e2016-02-20 14:05:55 +080049 <td><span class="title">dumb increment-protocol</span></td>
50 </tr>
Andy Greenaa850242016-02-20 07:52:35 +080051 <tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +080052 <td class="explain" colspan=2>
Andy Greenaa850242016-02-20 07:52:35 +080053The incrementing number is coming from the server at 20Hz and is individual for
Andy Greenc51823a2013-01-31 19:50:57 +080054each connection to the server... try opening a second browser window.
55<br/><br/>
Andy Greenaa850242016-02-20 07:52:35 +080056The button sends a message over the websocket link to ask the server
57to zero just this connection's number.
58 </td>
59 </tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +080060 <tr>
Andy Green97f3e662018-08-25 07:22:36 +080061 <td align=center><div id=number class="bigger"> </div></td>
Andy Green0ad1a6e2016-02-20 14:05:55 +080062 <td align=center>
Andy Greene35d91a2016-08-27 17:07:06 +080063 <input type=button id=offset value="Reset counter">
64 <input type=button id=junk value="Send junk">
Andy Green0ad1a6e2016-02-20 14:05:55 +080065 </td>
66 </tr>
Andy Greenaa850242016-02-20 07:52:35 +080067 </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 Green0ad1a6e2016-02-20 14:05:55 +080080 <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 Greenaa850242016-02-20 07:52:35 +080089 <div class="explain">
Andy Greenfe2a0d22010-11-12 13:10:40 +000090Use the mouse to draw on the canvas below -- all other browser windows open
91on this page see your drawing in realtime and you can see any of theirs as
92well.
Andy Greenc51823a2013-01-31 19:50:57 +080093<br/><br/>
Andy Greenfe2a0d22010-11-12 13:10:40 +000094The lws-mirror protocol doesn't interpret what is being sent to it, it just
95re-sends it to every other websocket it has a connection with using that
96protocol, including the guy who sent the packet.
Andy Greenc51823a2013-01-31 19:50:57 +080097<br/><br/>
Andy Green97f3e662018-08-25 07:22:36 +080098<b>libwebsockets-test-client</b> joins in by spamming circles on to this
99shared canvas when run.
Andy Greenaa850242016-02-20 07:52:35 +0800100 </div>
101 </td>
102 </tr>
103 <tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800104 <td colspan=2>Drawing color:
Andy Greene35d91a2016-08-27 17:07:06 +0800105 <select id="color">
Andy Greenaa850242016-02-20 07:52:35 +0800106 <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 Greenaa850242016-02-20 07:52:35 +0800111 </tr>
112 <tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800113 <td colspan=2 width=500 height=320>
Andy Green97f3e662018-08-25 07:22:36 +0800114 <div id="wslm_drawing" class="bgw"></div>
Andy Greenaa850242016-02-20 07:52:35 +0800115 </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 Green0ad1a6e2016-02-20 14:05:55 +0800130 <td>
131
Andy Greenaa850242016-02-20 07:52:35 +0800132 </td></tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800133 <tr><td id=ot_statustd align=center class="wsstatus">
134 <span id=ot_status>Websocket connection not initialized</span>
135 </td>
Andy Green97f3e662018-08-25 07:22:36 +0800136 <td colspan=2><span class="title">Open and close testing
137 </span></td>
Andy Green974bed42015-11-15 09:24:25 +0800138 </tr>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800139 <tr>
Andy Green97f3e662018-08-25 07:22:36 +0800140<td class="explain" colspan=3 >
141To help with open and close testing, you can open and close a connection by
142hand using the buttons.<br>
Andy Greenaa850242016-02-20 07:52:35 +0800143 "<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
146initiate the close, which it does with code 1001 and reason "Seeya".
Andy Green0ad1a6e2016-02-20 14:05:55 +0800147</td></tr>
Andy Green97f3e662018-08-25 07:22:36 +0800148 <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 Green974bed42015-11-15 09:24:25 +0800157
Andy Green0ad1a6e2016-02-20 14:05:55 +0800158</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 Green97f3e662018-08-25 07:22:36 +0800176 <span class="title">Server Info</span>
177 <input type=button id=pmd value="Test pmd">
Andy Green9287f7d2017-03-20 19:07:19 +0800178
Andy Green0ad1a6e2016-02-20 14:05:55 +0800179 </td>
180 </tr><tr>
181<td class="explain" colspan=2>
182This information is sent by the server over a ws[s] link and updated live
183whenever the information changes server-side.
184</td></tr>
185 <tr>
Andy Greenf79534e2016-04-25 10:04:49 +0800186 <td align=center colspan=2><div id=servinfo></div></td>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800187 </tr>
188 <tr>
Andy Green97f3e662018-08-25 07:22:36 +0800189 <td align=center colspan=2><div id=conninfo class="conninfo"></div></td>
Andy Green0ad1a6e2016-02-20 14:05:55 +0800190 </tr>
191</table>
Andy Greenaa850242016-02-20 07:52:35 +0800192</div>
193 </div>
194 </div>
195
Andy Greenf79534e2016-04-25 10:04:49 +0800196 <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 Greenc55fd272016-06-08 10:07:02 +0800202 <table width=100%>
Andy Greenf79534e2016-04-25 10:04:49 +0800203 <tr>
204 <td colspan=1>
205<span class="title">POST Form testing</span>
206 </td>
207 </tr><tr>
208<td class="explain" colspan=2>
209This tests POST handling in lws.
210</td></tr>
211 <tr>
Andy Green97f3e662018-08-25 07:22:36 +0800212 <td align=center colspan=2 class=tdform><div id=postinfo>
Andy Greenc55fd272016-06-08 10:07:02 +0800213 FORM 1: send with urlencoded POST body args<br>
Andy Greenf79534e2016-04-25 10:04:49 +0800214 <form action="formtest" method="post">
Andy Green97f3e662018-08-25 07:22:36 +0800215 <span class="f12">Some text: </span>
Andy Greenc55fd272016-06-08 10:07:02 +0800216 <input type="text" name="text" value="Give me some text"><br>
217 <input type="submit" name="send" value="Send the form">
Andy Greenf79534e2016-04-25 10:04:49 +0800218 </form>
219 </div></td>
220 </tr>
Andy Greenc55fd272016-06-08 10:07:02 +0800221
Andy Greenc55fd272016-06-08 10:07:02 +0800222
223 <tr>
Andy Green97f3e662018-08-25 07:22:36 +0800224 <td align=center colspan=2 class=tdform><div id=postinfo >
Andy Greenc55fd272016-06-08 10:07:02 +0800225 FORM 2: send with multipart/form-data<br>
226 (can handle file upload, test limited to 100KB)<br>
Andy Green97f3e662018-08-25 07:22:36 +0800227 <form name=multipart action="formtest" method="post"
228 enctype="multipart/form-data">
229 <span class="f12">Some text: </span>
Andy Greenc55fd272016-06-08 10:07:02 +0800230 <input type="text" name="text" value="Give me some text">
231<br>
Andy Green97f3e662018-08-25 07:22:36 +0800232 <input type="file" name="file" id="file" size="20">&nbsp;
233 <span id=file_info class="f12"></span><br>
Andy Greenc55fd272016-06-08 10:07:02 +0800234 <input type="submit" id="upload" name="upload" disabled=1 value="Upload">
235 </form>
236 </div></td>
237 </tr>
238
Andy Greenf79534e2016-04-25 10:04:49 +0800239</table>
240</div>
241 </div>
242 </div>
243
Andy Greenaa850242016-02-20 07:52:35 +0800244</div>
245</td></tr></table>
246
Andy Green97f3e662018-08-25 07:22:36 +0800247Looking 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/>
251Join the mailing list:
252<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets">
253 https://libwebsockets.org/mailman/listinfo/libwebsockets</a>
Andy Greenc51823a2013-01-31 19:50:57 +0800254
Andy Greenc51823a2013-01-31 19:50:57 +0800255</article>
Andy Greenab7d9332010-11-11 13:19:19 +0000256
Andy Green775c0dd2010-10-29 14:15:22 +0100257</body>
258</html>