-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP8266 won't connect to server #1
Comments
I had forgotten to update the headet |
you need to adjust |
Ok thank you so much for replying. I am stuck at getting the ESP connect to our server. I will try using your app.js code and see if I can connect to it. |
let me know if you need any assistance running it. |
So now I ran your server. i.e app.js then I ran the Hello_Time_esp8266 code on the ESP module. It is able to connect to the wifi, and gets the ip address but for connection to server it fails. Here is the output WiFi connected I wanted to know if |
you need to adjust these 2 lines depending on your server |
you will also need to update a line in index.html <script src='//192.168.0.5:1234/socket.io/socket.io.js'></script>to match your server IP |
Can you tell me how to find what ip address did the server get? |
you could use http://www.whatsmyip.org/ |
@washo4evr Thank you so much!!! I am able to connect to our servers now. Your library has made my day. I will keep you in loop as to how my project goes. |
Awesome!! |
One last question, can you throw some light on how you have implemented custom events in your code? Are you waiting on some specific message from the server to start listening to it? |
you can send messages (in app.js or index.html) via socket.emit('arduino' ,"Hello World!"); or client.send (in arduino) |
@washo4evr : I have been using your library for a week now. Its really helpful and I have been able to send some data to our server. We have a little problem now. We have a custom even named init device which expects "message" in the following form: |
Hey, |
Okay I will also try adding support on my end. Lets see if I can get something going. Thanks for replying |
Hi, String message = "42["JSON",{"Date":"17.03.2012 15:28 : 47","bindings": [{"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://."},{"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete."},{"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}]}]"; from the ESP8266, you need, inside app.js to add function ParseJson(jsondata) { the last console.log will return PRIVMSG Im still adding support inside the library but that works already like that |
I have updated the library as well as the esp8266 example and app.js let me know if everything works |
Okay will try the updated code on Monday. I don't have my gadgets with me at the moment! Thanks a lot. |
@washo4evr . Hi so I tried with the updated code, I can send strings to my server without any problem now. Later I figured out that there was problem when I tried sending " specifically. I had a question for you though, like the client.send() method do you have any receive method that will display the message received from the server? |
Im glad you got it working |
@washo4evr. Its been two weeks that I have tested my module on the server. Everything is fine except power failure. When my module gets accidentally powered down it cannot connect back to the server. I have to re-start my server instance each time something like this occurs. Upon debugging the code I found that this particular code snippet from your SocketIOClient.cpp file is where the client fails to connect to the server over web socket. bool SocketIOClient::readHandshake() { Why do we have to reconnect over websocket connection? Cant the communication go through socket.io itself |
you need to do that after the upgrade, else you are not connected via websocket on power loss, the module should be able to reconnect this is the behavior I get here |
Hey so from what I understood is that we first establish a connection over socket.io then we upgrade and establish connection via websockets. once the websocket connection is done we then start sending data via custom events like atime etc.. Please correct me if I got it wrong |
Actually, this time it failed to connect both times. Do you think there could be a issue on the server side? |
did you change the delay? |
I did try 0 , 5000, 10000 delays so far. Yes the first part actually goes through in a second or two actually. |
https://www.youtube.com/watch?v=sQ4PkcvcJmU&feature=youtu.be In this video I have tried to capture the output window, the delay is 2000 before it tries to connect over Websocket |
the 1st wait is a bit long you could try to change the if by a while and see how long it takes |
@washo4evr, Thank you for your work, I did try to use your socketio programs 4 days ago. It works but, I have a big problem, with the too long connecting time. This is the timestamped log about it: WiFi connected |
it is indeed a very long time to connect |
I use nodeMCU1.0 -ESP-12E with Arduino IDE 1.6.7 and ESP8266 2.1.0-rc2 second I tried with remote remote server: My sw and hw system can connect within 1sec with this arduino websocket, https://github.com/Links2004/arduinoWebSockets |
Hi, |
hi, on local server the node install file is: node-v5.6.0-x64.msi |
did you try after disabling your antivirus / firewall? |
A new problem, in SocketIOClient::parser doesnt work well if the incoming socket lenght bigger than 126 byte, I think the program doesnt takes different between small and larger size of soket. antivirus / firewall: I think if the antivirus / firewall makes the problem the connect never works, but it works with long delay. |
the problem, in SocketIOClient::parser fixed, now works
|
awesome, great fix, thx. |
Hi, pls help, I cant reconnect to server after I stop and start the socket.io server. |
you need to check for the absence of communication from the server and if nothing received for the last xxx seconds / minutes then, you can do client.stop or reconnect i have been super busy recently, but the project is still alive. |
@washo4evr Have you ever tried using a mobile app to feed the wifi SSID and Password into the chip at run time? I am trying to so that I can take my project anywhere and connect to the WIFI network available there without having to program the chip exclusively for my home WIFI where I have been developing the project |
That is a great idea I will give it a try, not sure when. I start my new job on monday. |
@washo4evr Congratulations on your new job. I did some changes on a code from the internet for the ESP8266 to host a web-server to take user input for the Wi-Fi network name and password. Just have to work a way to reboot and use this information to connect to an external server now. I will keep you posted as well |
thanks :) you could store the date in EEPROM and then do a soft-reboot using the reset pin |
you can actually use softAP in a function and then end it and create a server with the data the just received. any progress on your end? |
@washo4evr I am indeed using softAP at the time of setup and then later I have initiated the client mode. The sequence in which you write these two statements is very important. Apparently you don't have to restart the ESP if you do it this way. I basically tried using the ESP in client+AP mode but that didn't work. I could not connect my phone to the ESP(in this case as an AP). Long story short this is the way I am currently using my ESP WiFi.softAP(). On the webpage that I am hosting I wait for user to feed in the wifi network name & SSID my ESP is supposed to connect to. Once I get that information then I give the WiFi.begin(ssid, password); command and proceed to use the ESP in client mode for most part. Cheers!! |
Which version of Socket.IO are you using? |
Hello,
I am using Socket.IO version 2.0.3. But the strange thing is, i change the
host to a wrong IP address but it still not print "connection failed", it
stucked like this. Even correct IP address it still stucked there.
. [image: Hình ảnh nội tuyến 1]
2017-09-22 11:06 GMT+07:00 washo4evr <[email protected]>:
… Which version of Socket.IO are you using?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARmWr3mFiwuA4gRdm3wTqJQTZ4W0AvLzks5skzIwgaJpZM4HeTH2>
.
|
this library, as of today, is not compatible with Socket.IO 2.x |
Hello,
Thank you for creating this library. So, which version of Socket.IO is
compatible for this library?
…On 22 Sep 2017 11:47, "washo4evr" ***@***.***> wrote:
this library, as of today, is not compatible with Socket.IO 2.x
It is a plan for the future but I have no ETA
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARmWrxwzSae_f7PRvYfgEEDXdGH06wurks5skzvOgaJpZM4HeTH2>
.
|
any 1.x.y version of socket.IO library will work |
hey @washo4evr . Connected. SID= 404Not FoundThe resource requested could not be found on this server! any solution ? |
Hi farhad1372, which versions are you suing? (arduino version, node.js version...) |
@washo4evr, have you used this library for a server code written by you? In your comment you write that you are trying to connect to spark fun via HTTP commands. Please clarify if this is a socket.io connection that you are trying to establish or just a TCP connection.
The text was updated successfully, but these errors were encountered: