mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
gently close the connection before leaving the page
This commit is contained in:
@@ -13,4 +13,8 @@ client.on('connect', () => {
|
||||
client.on('message', (topic, message) => {
|
||||
// message is Buffer
|
||||
console.log(message.toString());
|
||||
})
|
||||
});
|
||||
|
||||
window.onbeforeunload = () => {
|
||||
client.end();
|
||||
};
|
||||
Reference in New Issue
Block a user