In the last few day, I have try to use my ESP8266 to run MrlCommand communicate with it using a WiFi protocol.

So far I manage to

  • Have a MRLComm version that can compile and run under my ESP8266 (ESP8266_12 variant)
  • Add a websocket library to MrlComm that act as a websocket server and that connect to my local network
  • using javascript in a webpage, I can connect to the esp8266 websocket server and send/receive MrlComm messages
  • the websocket class in MrlComm have the same interface as SerialHardware, so it can replace it for the ESP8266

While there is still a lot of work to have it fully worky, I'm quite happy with the results so far. But I still have to work on implementing that in MRL

WebSocket may not be the best protocol to use, so I will like to heard opinions on what could be a better protocol. I must admit that my knowledge is limited on that point. But for testing purpose, the websocket serve me well so far

GroG

7 years 2 months ago

Calamity !Pwebsockets were original designed to have full-duplex communication from browser to webserver (very cool) .. and that's why all that fancy HTML-5 stuff works where things magically happen without a "refresh"

Currently the MRLComm protocol we use is binary..   you can do binary over websockets, but I believe it requires that you base64 encode everything, ALSO, we'd need to have a Port class which could do a websocket (client side) for your websocket implementation on the ESP8266.   It could be done,..

However, what I would recommend is finding a good plain TCP/IP server for the ESP8266.   Websocketss is built on top of TCP/IP.  TCP/IP handles binary protocols nicely.  Additionally, MRL is currently ready with no more development.  I created a TCP/IP Port class, and you can connect a Serial service like this ...

serial.connect("192.168.0.32", 80)

This will connect the Serial service to a TCP/IP server.. and the Arduino service using this Serial service will not know anything about the details of the connection .. and stuff will just be WORKY !

I have try to use tcp but failed miserably. 

I couln`t transfer any data. The best I could do is to have Mrl connect to the ESP8266, but the connection close immédiatly without the possibility to send or read anything.