washo4evr / Socket.io-v1.x-Library

Socket.io Library for Arduino
108 stars 58 forks source link

ESP8266 not getting connected to SocketIO server #22

Open romuye123 opened 8 years ago

romuye123 commented 8 years ago

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

washo4evr commented 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

raphael-fernandes commented 7 years ago

@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.

washo4evr commented 7 years ago

any update? did you succesfully have a webpage communicate with the server?