aboutsummaryrefslogtreecommitdiff
path: root/test-apps/test.html
blob: f4b89a73ad814bd289e8e2f045cd661c8b967a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset=utf-8 http-equiv="Content-Language" content="en"/>
 <link rel="stylesheet" type="text/css" href="test.css"/>
 <script type='text/javascript' src="/lws-common.js"></script>
 <script type='text/javascript' src='test.js'></script>
 <title>Minimal Websocket test app</title>
</head>

<body>
<header></header>
<article>

<table><tr><td>

<table width=600px>
 <tr>
  <td valign=middle align=center>
   <a href="https://libwebsockets.org">
    <img src="libwebsockets.org-logo.svg"></a></td><td>
	<section class="browser">
	<div id=brow>...</div></section>
  </td>
  <td width="64" height="64" id="wstransport"></td>
  <td width="64" height="64" id="transport"></td>
 </tr>

</table>
</td></tr>
<tr><td colspan=2 align=center>
Click <a href="leaf.jpg" target="_blank">Here</a> to
have the test server send a big picture by http.
</td></tr>
<tr><td colspan=2>
<div class="tabs">

   <div class="tab">
       <input type="radio" id="tab-1" name="tab-group-1" checked>
       <label for="tab-1">Dumb Increment Demo</label>
       
       <div class="content">
        <div id="dumb" class="group2">
         <table>
          <tr>
	   <td id=wsdi_statustd align=center class="wsstatus">
	     <span id=wsdi_status>Websocket connection not initialized
	     	</span></td>
           <td><span class="title">dumb increment-protocol</span></td>
	   </tr>
	   <tr>
	   <td class="explain" colspan=2>
The incrementing number is coming from the server at 20Hz and is individual for
each connection to the server... try opening a second browser window.
<br/><br/>
The button sends a message over the websocket link to ask the server
to zero just this connection's number.
	   </td>
	  </tr>
	   <tr>
	    <td align=center><div id=number class="bigger"> </div></td>
	    <td align=center>
	     <input type=button id=offset value="Reset counter">
	     <input type=button id=junk value="Send junk">
	    </td>
	    </tr>
	 </table>
	</div>
       </div> 
   </div>

   <div class="tab">
    <input type="radio" id="tab-2" name="tab-group-1">
    <label for="tab-2">Mirror Demo</label>
       
    <div class="content">
     <div id="mirror" class="group2">
      <table>
       <tr>
	 <td colspan=1 id=wslm_statustd align=center class="wsstatus">
	 <span id=wslm_status>Websocket connection not initialized</span>
	</td>
        <td>
         <span class="title">lws-mirror-protocol</span>
        </td>
       </tr>
       <tr>
       <td colspan=2>
         <div class="explain">
Use the mouse to draw on the canvas below -- all other browser windows open
on this page see your drawing in realtime and you can see any of theirs as
well.
<br/><br/>
The lws-mirror protocol doesn't interpret what is being sent to it, it just
re-sends it to every other websocket it has a connection with using that
protocol, including the guy who sent the packet.
<br/><br/>
<b>libwebsockets-test-client</b> joins in by spamming circles on to this
shared canvas when run.
         </div>
        </td>
       </tr>
       <tr>
	<td colspan=2>Drawing color:
	  <select id="color">
		<option value=#000000>Black</option>
		<option value=#0000ff>Blue</option>
		<option value=#20ff20>Green</option>
		<option value=#802020>Dark Red</option>
	  </select>
       </tr>
       <tr>
	 <td colspan=2 width=500 height=320>
		<div id="wslm_drawing" class="bgw"></div>
	</td>
       </tr>
      </table>
     </div>
    </div> 
   </div>
    
    <div class="tab">
       <input type="radio" id="tab-3" name="tab-group-1">
       <label for="tab-3">Close Testing</label>
     
       <div class="content">
<div id="ot" class="group2">
      <table>
       <tr>
        <td>

		</td></tr>
		<tr><td id=ot_statustd align=center class="wsstatus">
		 <span id=ot_status>Websocket connection not initialized</span>
		</td>
		<td colspan=2><span class="title">Open and close testing
				</span></td>
		</tr>
		<tr>	
<td class="explain" colspan=3 >
To help with open and close testing, you can open and close a connection by
hand using the buttons.<br>
 "<b>Close</b>" closes the connection from the browser with code 3000
  and reason 'Bye!".<br>
 "<b>Request Server Close</b>" sends a message asking the server to
initiate the close, which it does with code 1001 and reason "Seeya".
</td></tr>
	<tr>
	<td align=center>
	  <input type="button" id="ot_open_btn" value="Open"></td>
	<td align=center>
	  <input type="button" id="ot_close_btn" disabled value="Close" ></td>
	<td align=center>
	  <input type="button" id="ot_req_close_btn" disabled
	  	 value="Request Server Close" ></td>
	</tr>

</table>

</div>
       </div> 
   </div>
   
    <div class="tab">
       <input type="radio" id="tab-4" name="tab-group-1">
       <label for="tab-4">Server info</label>

       <div class="content">
<div id="ot" class="group2">
      <table>
       <tr>
	<td id=s_statustd align=center class="wsstatus">
	 <div id=s_status>Websocket connection not initialized</div>
	</td>
	        <td colspan=1>
	<span class="title">Server Info</span>
		<input type=button id=pmd value="Test pmd">

	</td>
	</tr><tr>
<td class="explain" colspan=2>
This information is sent by the server over a ws[s] link and updated live
whenever the information changes server-side.
</td></tr>
	<tr>
	<td align=center colspan=2><div id=servinfo></div></td>
	</tr>
	<tr>
	<td align=center colspan=2><div id=conninfo class="conninfo"></div></td>
	</tr>
</table>
</div>
       </div> 
   </div>

    <div class="tab">
       <input type="radio" id="tab-5" name="tab-group-1">
       <label for="tab-5">POST</label>

       <div class="content">
<div id="ot" class="group2">
      <table width=100%>
       <tr>
	        <td colspan=1>
<span class="title">POST Form testing</span>
	</td>
	</tr><tr>
<td class="explain" colspan=2>
This tests POST handling in lws.
</td></tr>
	<tr>
	<td align=center colspan=2 class=tdform><div id=postinfo>
	FORM 1: send with urlencoded POST body args<br>
	<form action="formtest" method="post">
 <span class="f12">Some text: </span>
  <input type="text" name="text" value="Give me some text"><br>
  <input type="submit" name="send" value="Send the form">
	</form>
	</div></td>
	</tr>


	<tr>
	<td align=center colspan=2 class=tdform><div id=postinfo >
	FORM 2: send with multipart/form-data<br>
	(can handle file upload, test limited to 100KB)<br>
	<form name=multipart action="formtest" method="post"
	      enctype="multipart/form-data">
  <span class="f12">Some text: </span>
  <input type="text" name="text" value="Give me some text">
<br>
  <input type="file" name="file" id="file" size="20">&nbsp;
   <span id=file_info class="f12"></span><br>
    <input type="submit" id="upload" name="upload" disabled=1 value="Upload">
	</form>
	</div></td>
	</tr>
	
</table>
</div>
       </div> 
   </div>

</div>
</td></tr></table>

Looking for support?
<a href="https://libwebsockets.org">https://libwebsockets.org</a>,
<a href="https://github.com/warmcat/libwebsockets">
	https://github.com/warmcat/libwebsockets</a></a><br/>
Join the mailing list:
<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets">
	https://libwebsockets.org/mailman/listinfo/libwebsockets</a>

</article>

</body>
</html>