Please is there anyone out here who can point me in a the right direction or give me a pointer, I have a project that I have been working on for a long time (a lot of code), I’m using an ESP8266 in my project I already implement connection using wired Ethernet, specifically Ethernet2 library, I have a web interface, dashboard, I also implement Modbus over TCP, MQTT, FTP, OTA updates, the web interface uses standard get request to load up data, I also have a dashboard that worked fine but I don’t want my project constantly send get request for information, so I decided to use the Websocket Lib (Websocket Server), this works a treat when using esp8266 and wifi, however I am not using wifi at all, in every single case and other libs I have found if you are using an ESP then defines in the websocket lib point it to use the wifi connection, I have tried everything to disable it and force lib to use my Ethernet connection, but in some cases even thought you can select network type the websocket lib normally has includes with standard Ethernet library causing errors , in any case no matter what I do I cannot seem to get my project to connect via websocket, when I open browser, does anybody know or can suggest how I can modify websocket lib for esp8266 websocket server to get it to use my Ethernet2 connection that is already up running and defined in my project? This is the final part I need to complete I’ve been searching for weeks I’m using the standard ArduinoWebsocketLib 2.3.6, my Pcb is a purpose design and uses w5500 and that’s why I use Ethernet2 because it works fine!
I am using the standard ethernet.h and that works fine for me with a w5500, mind you i have no idea about the websocket, which is of course you question.
can you please post a link to the library you are using, (and the ethernet2 library as well please) so we can have a look knowing that we are looking at the right code.
What ESP core are you using ? (latest v is 3.1.1)
Would be nice to see those errors, since we can not recreate your issue like this.
we need to see it or at least a relevant example of what you try to do and how it isn't working.
Thanks for the kind replies guys, I am by no means an experience programmer, however my project as you can imagine is approaching a fair few lines of code, Interesting that you both manned to get the standard Ethernet library to to work, I’m sure that the Ethernet2 Lib (ver 1.0.4) was an update of the standard Ethernet lib created by Paul S, in any case I believe that’s it’s direct replacement and my Ethernet connection seems stable and works, I was using Websocket Lib created by Limks2004 ver 2.3.6, as I said this works fine when using ESP8266 connected to Wifi, but I think because of all the bells and whistles it’s still trying to connect using Wifi in this project, I’m sure I must be able to modify the websocket lib to force it to use connection via as defined in my Ethernet connection. I’m using a slightly older version of the ESP lib ( 2.7.4) because I’m using Little FS as my project loads and saves a lot of config data via SPIFFs plus if I update it breaks loads of stuff and I figured if I have the project as far as I have and it’s working as planned why change But if anyone can point out what I actually need to change to get the websocket to connect via Ethernet I would be most grateful many thanks
No problem with that, though ethernet tcp connections from version 3.x.x onwards can be directly routed to the same object as the wifi connection, so it may work as expected with v 3 core, still i can understand your predicament.
Please post a link to the github repository
Also no problem with that, but i would like to see an example of the code that doesn't work, but should, or only works with WiFi. Chances are with a small modification the websocket lib can be changed as to provide you with
Btw I have tried to define network type W51XX as detailed, but still connection fails, if you look in the Websockets.h file I can see that the if defined statement uncommenting line 116 I thought should do it, futher down line 157 if had ifdef ESP8266 Im assuming this still allows ESP to reference WIFI including WIFI.h and setting websocket class to look at WIFI client? of course below that I can work out that there are all the othe other options, at line 177 is the include for Ethernet.h, I tried to work through the websockets .h file and comment out any reference to ESP and Wifi network, off course if I leave the Ethernet include this is where problems start as i end up with load of errors compile, I assume because I have two definitions going on with Ethernet and Ethernet2.h already in my main project , please excuse me I don't pretend to understand it all I pretty much learn by looking how somebody has written something and work from there, Correct me if I'm wrong but I'm assuming i need to get the webserver class to reference my current ethernet connection or am i on the wrong track completely here?