DEV Community

w4ilun
w4ilun

Posted on

Control your Intel Edison in Realtime with Websockets (and ngrok)!

(Note: these posts are migrated from my previous medium.com blog)

First off, I would like to thank Nathan Meryash for his suggestions! In my next few posts, I will describe using different cloud services and technologies for your IoT project.

Following up with Control your Intel Edison in Realtime with Websockets!, this post briefly describes how you could expose your connected device to the public web using ngrok. This is useful if you would like to be able to control your device from outside of your home network, without having to setup port forwarding and/or DDNS.

ngrok is a service that “exposes a local server behind a NAT or firewall to the internet”. There is no signup required and you get a public URL accessible from the Internet!

Image courtesy of ngrok [https://ngrok.com/](https://ngrok.com/)

There are 2 additional packages that you would need to install:

npm install ngrok --save
npm install express-dot-engine --save

ngrok: an npm module for using ngrok. It allows you to programmatically create a new ngrok instance URL (e.g. https://571a6a18.ngrok.io) and bind it to your local server IP and port.

**express-dot-engine: **a lightweight template engine for embedding our ngrok URL into our index.html file

Here is the new code that has been updated to include the use of ngrok and the dot template engine with Express:

Then, simply run:

node blinkWithSocketsNgrok.js

…and go to the generated URL from anywhere on the web!

Top comments (0)