-
Notifications
You must be signed in to change notification settings - Fork 140
/
index.html
314 lines (272 loc) · 12.8 KB
/
index.html
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<!--[if IE 8]>
<html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="description" content="Try HiveMQ MQTT browser client – a websocket client that you can use to experiment with publishing and subscribing MQTT messages over port 8000">
<title>MQTT Websocket Client</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/foundation.css">
<link rel="stylesheet" href="css/jquery.minicolors.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css">
</head>
<body class="notconnected">
<div id="header">
<div>
<a href="https://www.hivemq.com"><img id="headerlogo" src="assets/hivemq-logo.svg" alt"HiveMQ Logo" title="HiveMQ" style="width: 275px; height: 65px"></a>
<span id="headertitle">Websockets Client Showcase</span>
</div>
</div>
<div id="content" class="row">
<div id="connection" class="row large-12 columns">
<div class="large-8 columns conniTop">
<h3>Connection</h3>
</div>
<div class="large-1 columns conniStatus">
<div id="connectionStatus"></div>
</div>
<div class="large-2 columns conniArrow">
<a class="small bottom conniArrow" onclick="websocketclient.render.toggle('conni');">
<div class="icon-arrow-chevron"></div>
</a>
</div>
<div class="large-12 columns" id="conniMain">
<div class="panel">
<div class="row">
<form class="custom">
<div class="large-5 columns">
<label>Host</label>
<input id="urlInput" type="text" value="broker.mqttdashboard.com">
</div>
<div class="large-1 columns">
<label>Port</label>
<input id="portInput" type="text" value="8000"/>
</div>
<div class="large-4 columns">
<label>ClientID</label>
<input id="clientIdInput" type="text"/>
</div>
<div class="large-2 columns">
<a id="connectButton" class="small button" onclick="websocketclient.connect();">Connect</a>
</div>
<div class="large-2 columns">
<a id="disconnectButton" class="small button"
onclick="websocketclient.disconnect();">Disconnect</a>
</div>
<div class="large-4 columns">
<label>Username</label>
<input id="userInput" type="text"/>
</div>
<div class="large-3 columns">
<label>Password</label>
<input id="pwInput" type="password"/>
</div>
<div class="large-2 columns">
<label>Keep Alive</label>
<input id="keepAliveInput" type="text" value="60"/>
</div>
<div class="large-1 columns">
<label>SSL</label>
<input id="sslInput" type="checkbox"/>
</div>
<div class="large-2 columns">
<label>Clean Session</label>
<input class="checky" id="cleanSessionInput" type="checkbox" checked="checked" disabled="disabled"/>
</div>
<div class="large-8 columns">
<label>Last-Will Topic</label>
<input id="lwTopicInput" type="text"/>
</div>
<div class="large-2 columns">
<label>Last-Will QoS</label>
<select id="lwQosInput">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="large-2 columns">
<label>Last-Will Retain</label>
<input class="checky" id="LWRInput" type="checkbox"/>
</div>
<div class="large-12 columns">
<label>Last-Will Messsage</label>
<textarea id="LWMInput"></textarea>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="empty"></div>
<div id="publish-sub" class="row large-12 columns">
<div class="columns large-8">
<div class="large-9 columns publishTop">
<h3>Publish</h3>
</div>
<div class="large-3 columns publishArrow">
<a class="small bottom publishArrow" onclick="websocketclient.render.toggle('publish');">
<div class="icon-arrow-chevron"></div>
</a>
</div>
<div class="large-12 columns" id="publishMain">
<!-- Grid Example -->
<div class="row panel" id="publishPanel">
<div class="large-12 columns">
<form class="custom">
<div class="row">
<div class="large-6 columns">
<label>Topic</label>
<input id="publishTopic" type="text" value="testtopic/1">
</div>
<div class="large-2 columns">
<label for="publishQoSInput">QoS</label>
<select id="publishQoSInput" class="small">
<option>0</option>
<option>1</option>
<option>2</option>
</select>
</div>
<div class="large-2 columns">
<label>Retain</label>
<input id="publishRetain" type="checkbox">
</div>
<div class="large-2 columns">
<a class="small button" id="publishButton" onclick="websocketclient.publish($('#publishTopic').val(),$('#publishPayload').val(),parseInt($('#publishQoSInput').val(),10),$('#publishRetain').is(':checked'))">Publish</a>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label>Message</label>
<textarea id="publishPayload"></textarea>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="empty"></div>
<div class="large-9 columns messagesTop">
<h3>Messages</h3>
</div>
<div class="large-3 columns messagesArrow">
<a class="small bottom messagesArrow" onclick="websocketclient.render.toggle('messages');">
<div class="icon-arrow-chevron"></div>
</a>
</div>
<div class="large-12 columns" id="messagesMain">
<!-- Grid Example -->
<div class="row panel">
<div class="large-12 columns">
<form class="custom">
<!--<div class="row">-->
<!--<div class="large-10 columns">-->
<!--<label>Filter</label>-->
<!--<input id="filterString" type="text">-->
<!--</div>-->
<!--<div class="large-2 columns">-->
<!--<a class="small button" id="filterButton"-->
<!--onclick="websocketclient.filter($('#filterString').val())">Filter</a>-->
<!--</div>-->
<!--</div>-->
</form>
<div class="row">
<ul id="messEdit" class="disc">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="columns large-4">
<div class="large-8 columns subTop">
<h3>Subscriptions</h3>
</div>
<div class="large-3 columns subArrow">
<a class="small bottom subArrow" onclick="websocketclient.render.toggle('sub');">
<div class="icon-arrow-chevron"></div>
</a>
</div>
<div class="large-12 columns" id="subMain">
<div class="row panel">
<div class="large-12 columns">
<a id="addSubButton" href="#data" class="small button addSubButton">Add New Topic Subscription</a>
<div style="display:none">
<div id="data">
<form class="custom">
<div class="row large-12 columns">
<div class="large-4 columns">
<label>Color</label>
<input class="color" id="colorChooser" type="hidden">
</div>
<div class="large-5 columns">
<label for="QoSInput">QoS</label>
<select id="QoSInput" class="small">
<option>2</option>
<option>1</option>
<option>0</option>
</select>
</div>
<div class="large-3 columns">
<a class="small button" id="subscribeButton"
onclick="if(websocketclient.subscribe($('#subscribeTopic').val(),parseInt($('#QoSInput').val()),$('#colorChooser').val().substring(1))){$.fancybox.close();}">Subscribe</a>
</div>
</div>
<div class="row large-12 columns">
<div class="large-12 columns">
<label>Topic</label>
<input id="subscribeTopic" type="text" value="testtopic/#">
</div>
</div>
</form>
</div>
</div>
<ul id="innerEdit" class="disc">
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/4.2.3/js/foundation.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/4.2.3/js/foundation/foundation.forms.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.1.0/moment.min.js"></script>
<script src="js/jquery.minicolors.min.js"></script>
<script src="js/mqttws31.js"></script>
<script src="js/encoder.js"></script>
<script src="js/app.js"></script>
<script>
function randomString(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
$(document).foundation();
$(document).ready(function () {
$('#clientIdInput').val('clientId-' + randomString(10));
$('#colorChooser').minicolors();
$("#addSubButton").fancybox({
'afterShow': function () {
var rndColor = websocketclient.getRandomColor();
$("#colorChooser").minicolors('value', rndColor);
}
});
websocketclient.render.toggle('publish');
websocketclient.render.toggle('messages');
websocketclient.render.toggle('sub');
});
</script>
</body>
</html>