morrissinger / ESP8266-Websocket

A websocket library for the ESP-8266.
305 stars 119 forks source link

Socket Connection Demo Hangs on "H" #7

Open flimshaw opened 8 years ago

flimshaw commented 8 years ago

Hey there,

Thanks so much for your work on this. I'm getting the following message in my serial console when trying to run the demo, seems like it's connecting but then crashing shortly after? Log is as follows:

Connecting to **** ... WiFi connected IP address: 10.10.10.106 Connected Waiting... H

creation9 commented 8 years ago

I have the same problem. I have narrowed it down to the analyserequest method in websocketserver.cpp. Once the header "upgrade: websocket" is recieved, serial.print prints out garbage. Im still digging.

mattfelsen commented 8 years ago

Just ran into this myself too. I set the serial port rate down to 9600 and things are working for me. Turns out that even with broken serial output, the code was still running fine, i.e. I had the module sending strings to a websocket server on my computer and they were coming in.

gifsicle

deepikavira commented 8 years ago

Hi Mattfelsen, what code were you running on the server side? this the output which I am getting stuck at: WiFi connected IP address: 172.16.42.43 Connected þ

There is no response after that. Any idea what may be going wrong?

creation9 commented 8 years ago

Like Mattfelsen said, the program is still running, it just looks like it isnt. I don't use the esp's serial output in my recent projects right now. My esp is just responding to json commands by controlling other devices. Still havent figured out why the serial is freezing though.

On Mon, Feb 8, 2016 at 7:08 PM, deepika notifications@github.com wrote:

Hi Mattfelsen, what code were you running on the server side? this the output which I am getting stuck at: WiFi connected IP address: 172.16.42.43 Connected þ

There is no response after that. Any idea what may be going wrong?

— Reply to this email directly or view it on GitHub https://github.com/morrissinger/ESP8266-Websocket/issues/7#issuecomment-181653793 .

mattfelsen commented 8 years ago

@deepikavira It was just a simple websocket echo server written with node.js and ws. Did you try changing the serial port baud rate (both in the code and in the Arduino IDE serial monitor window)?

deepikavira commented 8 years ago

@mattfelsen thanks for the quick response. I did reduce the baud rate to 9600 but still no luck with the serial monitor. It now shows the following: WiFi connected IP address: 172.16.42.43 Connected Waiting... ÿ

Anyway I think I will try giving it some functionality after the handshake and see if that works. @creation9 thanks for your quick response as well.

mattfelsen commented 8 years ago

@deepikavira If you're having trouble with this library, there's another arduino websocket server/client lib for esp8226 here: https://github.com/Links2004/arduinoWebSockets I haven't tried it myself, but could be helpful if you're stuck

ildr3him commented 8 years ago

+1

sfa1906 commented 8 years ago

Was facing a similar problem..

// capture the value of analog 1, send it along // pinMode(1, INPUT); //data = String(analogRead(1));

data= "Hii";
webSocketClient.sendData(data);

Remove or comment-out the lines as shown above, put a string in 'data' variable and set the baud to 230400 and it works like charm..

jthiller commented 8 years ago

Based on @sfa1906's findings, thought I'd share my experience with this issue. Setting pinMode(1, INPUT); inside of the loop seems to be the problem here. By moving it into setup I've managed to clear the issue.

aliwo commented 7 years ago

jthiller, you are my savior