Socket with html / app with server
Posted: Fri Oct 03, 2014 4:19 am
I set a new goal. I'm trying to connect a App or Html page with the Esp8266, and making a socket connection..
I'm able to connect to the Esp using a program on the computer:
http://sockettest.sourceforge.net/
Then I tried a Cordova (Android / Ios) plugin to try to setup a socket connection. I tried:
https://github.com/Tlantic/cdv-socket-plugin
But I'm unable to connect ..
____________________________
I want to configure my esp8266 as server so I setup like this in the Serial console:
*** SERIAL ***
// Connect to the network
AT+CWJAP="SSID","PASS"
AT+CIFSR
192.168.1.103
// Make it a server
AT+CIPMUX=1
AT+CIPSERVER=1,8000
*** /SERIAL
*** HTML ***
Then I have a HTML page trying to connect to the server:
if ("WebSocket" in window) {
console.log("WebSocket is supported by your Browser!");
// open the websocket
ws = new WebSocket("ws://192.168.1.103:8000");
}
*** /HTML ***
When the HTML page visit the server I get:
*** SERIAL ***
+IPD,0,431:GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 192.168.1.103:8000
Origin: null
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: dCJ7dO0cFCL8Bfjszc6CVg==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
OK
*** /SERIAL ***
After a while my webconsole displays:
*** HTML ***
WebSocket connection to 'ws://192.168.1.103:8000/' failed: Connection closed before receiving a handshake response
** /HTML ***
And ESP said...
*** SERIAL ***
Unlink
*** /SERIAL ***
I tried to send messages in both way. But I think there must be a handshake first.
I'm able to connect to the Esp using a program on the computer:
http://sockettest.sourceforge.net/
Then I tried a Cordova (Android / Ios) plugin to try to setup a socket connection. I tried:
https://github.com/Tlantic/cdv-socket-plugin
But I'm unable to connect ..
____________________________
I want to configure my esp8266 as server so I setup like this in the Serial console:
*** SERIAL ***
// Connect to the network
AT+CWJAP="SSID","PASS"
AT+CIFSR
192.168.1.103
// Make it a server
AT+CIPMUX=1
AT+CIPSERVER=1,8000
*** /SERIAL
*** HTML ***
Then I have a HTML page trying to connect to the server:
if ("WebSocket" in window) {
console.log("WebSocket is supported by your Browser!");
// open the websocket
ws = new WebSocket("ws://192.168.1.103:8000");
}
*** /HTML ***
When the HTML page visit the server I get:
*** SERIAL ***
+IPD,0,431:GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 192.168.1.103:8000
Origin: null
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: dCJ7dO0cFCL8Bfjszc6CVg==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
OK
*** /SERIAL ***
After a while my webconsole displays:
*** HTML ***
WebSocket connection to 'ws://192.168.1.103:8000/' failed: Connection closed before receiving a handshake response
** /HTML ***
And ESP said...
*** SERIAL ***
Unlink
*** /SERIAL ***
I tried to send messages in both way. But I think there must be a handshake first.