-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.html
38 lines (29 loc) · 971 Bytes
/
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
<!DOCTYPE html>
<html lang="cn" ng-app="app">
<head>
<meta charset="utf-8">
<title>MQTT Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body ng-controller="indexCtrl">
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-mqtt/src/browserMqtt.js"></script>
<script src="bower_components/angular-mqtt/src/angular-MQTT.js"></script>
<script>
var app = angular.module('app', [
'ngMQTT'
]);
app.config(['MQTTProvider',function(MQTTProvider){
MQTTProvider.setHref('ws://cv.endaosi.com:18585');
}]);
app.controller('indexCtrl', ['$scope', 'MQTTService', function ($scope, MQTTService) {
MQTTService.on('hello', function(data){
alert(data)
});
MQTTService.send('hello','word');
MQTTService.send('hello','word1');
MQTTService.send('hello','word2');
}]);
</script>
</body>
</html>