Open romuye123 opened 8 years ago
Hi I would suggest you take a look at the example provided with the library for both the server part (app.js) and the client (Hello_Time_ESP8266.ino)
let me know if you need help with the example
@romuye123 , if you put a Socket.io client inside a HTML page, will this page connect to your server correctly? I'm asking this because we can trace the problem origin this way.
any update? did you succesfully have a webpage communicate with the server?
Hi,
I am unable to connect to SocketIO server. Following is my sketch file:
#include <ESP8266WiFi.h>
include "SocketIOClient.h"
SocketIOClient client;
const char* ssid = "myssid"; const char* password = "mypwd";
char host[] = "192.168.0.132"; int port = 3000;
extern String RID; extern String Rname; extern String Rcontent;
void setup() { Serial.begin(115200); delay(10); setupWifi();
if (!client.connect(host, port)) { Serial.println("connection failed"); return; }
if (client.connected()) { client.send("connection", "message", "Connected !!!!"); }
}
void setupWifi(){ Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println(""); Serial.println("WiFi connected");
Serial.println("IP address: "); Serial.println(WiFi.localIP());
}
void loop() { // put your main code here, to run repeatedly:
}`
Following is the output on serial
WiFi connected
IP address:
192.168.24.106
[hostByName] Host: 192.168.0.132 is a IP!
connection failed