-->
Page 1 of 2

ESP8266 client and webserver

PostPosted: Fri Jun 23, 2017 5:31 pm
by WisterDesigns
Hey everyone,
I would like to create a simple DIY protocol for my ESP8266 which will work as a smart home. I would like the ESP8266 always be connected to the webserver which will run on my computer which will get data from the webserver and to run the ESP8266 as a webserver which will be able to send data to the PC web server. I want to be able to control it from all over the world and as close to real time. What should I do and what should I use? Do you have any example or code for me?
Huge thanks!!

Re: ESP8266 client and webserver

PostPosted: Fri Jun 23, 2017 7:03 pm
by rudy
How much work do you want to put in? Without knowing that any answer would be a waste of time. What you are asking is really a big job. More than most people would want to put in. I would recommend not to develop your own protocol and to use some existing frameworks that accomplish what you need.

One of your main concerns should be security. And because you want to allow access over the internet that becomes anything but simple. I would recommend an external connection point that will be your access point into your system. Take a look at systems that use MQTT for communications. It is one popular option.

Re: ESP8266 client and webserver

PostPosted: Sat Jun 24, 2017 3:57 am
by WisterDesigns
I wanna try to create my own protocol. I want to control it from any where, I'll put my website on hosting and I need the ESP to connect to this hosting and then I'll be able to control it from anywhere there. First of all I will run it on localhost for testing. How should I do it? Send data to server with esp8266 and get data from server, two direction communication... of course based on Ajax as I said before.

Re: ESP8266 client and webserver

PostPosted: Sat Jun 24, 2017 5:49 am
by davydnorris
I was just about to say the same thing as rudy...

You don't need to invent your own protocol when there are very widely used, 'almost' industry standard approaches like MQTT available, with existing libraries for Arduino, and the NonOS and RTOS SDKs.

In addition, you have readily available MQTT brokers that will also integrate with Web Servers, or Cloud based MQTT offerings from dozens of different groups.

MQTT lets you define your own event and command set, a high level application specific language or 'protocol' for talking to your devices, so you don't need to reinvent anything. This also makes your devices portable between different brokers too.

That would be my strong recommendation