<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[npm library] @bugsounet&#x2F;internet]]></title><description><![CDATA[<h3><a class="plugin-mentions-user plugin-mentions-a" href="/user/bugsounet" aria-label="Profile: bugsounet">@<bdi>bugsounet</bdi></a>/internet</h3>
<p dir="auto">I created this library if you want to check internet connexion  in your module.<br />
This library is very simplified and ready for use in your <code>node_helper.js</code></p>
<p dir="auto"><em>This library is used in MMM-Assistant2Display</em></p>
<p dir="auto">single node routine for checking internet status</p>
<h4>Installation</h4>
<pre><code class="language-sh">npm install @bugsounet/internet
</code></pre>
<h4>Sample with pir contructor</h4>
<pre><code class="language-js">const Internet = require("@bugsounet/internet")

this.config = {
  delay: 10 * 1000,
  scan: "google.com",
  command: "pm2 restart 0",
  showAlert: true
}

var debug = true

this.internet = new Internet(this.config, callback, debug)
this.internet.start()
setTimeout(() =&gt; { this.internet.stop() } , 60 * 1000)

function callback(status, value) {
  if (status == "INTERNET_PING") console.log ("Ping:", value)
  if (status == "INTERNET_DOWN") console.log ("Conexion lost... Retry:", value)
  if (status == "INTERNET_RESTART") console.log ("Internet is back")
}
</code></pre>
<h4>constructor of internet</h4>
<p dir="auto">internet(internetConfig, callback, debug)</p>
<h5>internetConfig {}</h5>
<ul>
<li><code>delay</code> - set the interval for internet checking.</li>
<li><code>scan</code> - ping point name or address.</li>
<li><code>command</code> - command to execute when internet afresh available</li>
<li><code>showAlert</code> - send a callback Alert about internet connection lost and available</li>
</ul>
<h5>callback (status,value)</h5>
<ul>
<li><code>INTERNET_PING</code> - return current ping with value</li>
<li><code>INTERNET_DOWN</code> - return internet down status with number of retry in value</li>
<li><code>INTERNET_RESTART</code>- return internet available status</li>
</ul>
<p dir="auto"><code>INTERNET_DOWN</code> and <code>INTERNET_RESTART</code> will be sended only if <code>showAlert</code> feature is enable</p>
<h5>debug</h5>
<p dir="auto">if you want debuging information, just set to <code>true</code></p>
<h4>Functions</h4>
<ul>
<li><code>start()</code> : start internet scan</li>
<li><code>stop()</code> : force stop scan</li>
</ul>
]]></description><link>https://forum.magicmirror.builders/topic/12828/npm-library-bugsounet-internet</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 10:41:31 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/12828.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 May 2020 09:37:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [npm library] @bugsounet&#x2F;internet on Thu, 14 May 2020 11:23:05 GMT]]></title><description><![CDATA[<p dir="auto">it’s just my personal npm libraries :)</p>
<p dir="auto">I have 3 more … but i have to Make readme file (too lazy actually) :p</p>
]]></description><link>https://forum.magicmirror.builders/post/75175</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/75175</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 14 May 2020 11:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to [npm library] @bugsounet&#x2F;internet on Thu, 14 May 2020 11:16:12 GMT]]></title><description><![CDATA[<p dir="auto">Wow. You’ve been busy.</p>
]]></description><link>https://forum.magicmirror.builders/post/75173</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/75173</guid><dc:creator><![CDATA[bhepler]]></dc:creator><pubDate>Thu, 14 May 2020 11:16:12 GMT</pubDate></item></channel></rss>