mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-21 20:33:05 +08:00
Remove obsolete files from MQTTnet.Server.
This commit is contained in:
@@ -50,7 +50,7 @@ namespace MQTTnet.Server
|
|||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Console.WriteLine(@"
|
Console.WriteLine(@"
|
||||||
Version: 1.0.0-alpha1
|
Version: 1.0.0-alpha2
|
||||||
License: MIT (read LICENSE file)
|
License: MIT (read LICENSE file)
|
||||||
Sponsoring: https://opencollective.com/mqttnet
|
Sponsoring: https://opencollective.com/mqttnet
|
||||||
Support: https://github.com/chkr1011/MQTTnet/issues
|
Support: https://github.com/chkr1011/MQTTnet/issues
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>MQTTnet Server test</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="node_modules/systemjs/dist/system.js"></script>
|
|
||||||
<script>
|
|
||||||
System.config({
|
|
||||||
packages: {
|
|
||||||
'': {
|
|
||||||
defaultExtension: 'js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
map: {
|
|
||||||
mqtt: 'node_modules/mqtt/dist/mqtt.min'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
System.import('app/app');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<p id="state"></p>
|
|
||||||
<input id="topic" placeholder="topic" />
|
|
||||||
<input id="msg" placeholder="msg" />
|
|
||||||
<button id="publish">send</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<ul id="msgs" ></ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
import { connect } from "mqtt";
|
|
||||||
|
|
||||||
var client = connect('ws://' + location.host + '/mqtt',
|
|
||||||
{
|
|
||||||
clientId: "client" + Math.floor(Math.random() * 6) + 1
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onbeforeunload = () => {
|
|
||||||
client.end();
|
|
||||||
};
|
|
||||||
|
|
||||||
var publishButton = document.getElementById("publish");
|
|
||||||
var topicInput = <HTMLInputElement>document.getElementById("topic");
|
|
||||||
var msgInput = <HTMLInputElement>document.getElementById("msg");
|
|
||||||
var stateParagraph = document.getElementById("state");
|
|
||||||
var msgsList = <HTMLUListElement>document.getElementById("msgs");
|
|
||||||
|
|
||||||
publishButton.onclick = click => {
|
|
||||||
var topic = topicInput.value;
|
|
||||||
var msg = msgInput.value;
|
|
||||||
client.publish(topic, msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
client.on('connect', () => {
|
|
||||||
client.subscribe('#', { qos: 0 }, (err, granted) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
client.publish('presence', 'Hello mqtt');
|
|
||||||
|
|
||||||
stateParagraph.innerText = "connected";
|
|
||||||
showMsg("[connect]");
|
|
||||||
});
|
|
||||||
|
|
||||||
client.on("error", e => {
|
|
||||||
showMsg("error: " + e.message);
|
|
||||||
});
|
|
||||||
|
|
||||||
client.on("reconnect", () => {
|
|
||||||
stateParagraph.innerText = "reconnecting";
|
|
||||||
showMsg("[reconnect]");
|
|
||||||
});
|
|
||||||
|
|
||||||
client.on('message', (topic, message) => {
|
|
||||||
showMsg(topic + ": " + message.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
function showMsg(msg: string) {
|
|
||||||
//console.log(msg);
|
|
||||||
|
|
||||||
var node = document.createElement("LI");
|
|
||||||
node.appendChild(document.createTextNode(msg));
|
|
||||||
|
|
||||||
msgsList.appendChild(node);
|
|
||||||
|
|
||||||
if (msgsList.childElementCount > 50) {
|
|
||||||
msgsList.removeChild(msgsList.childNodes[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user