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