Skip to content
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 not getting connected to SocketIO server #22

Open
romuye123 opened this issue Aug 11, 2016 · 3 comments
Open

ESP8266 not getting connected to SocketIO server #22

romuye123 opened this issue Aug 11, 2016 · 3 comments

Comments

@romuye123
Copy link

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
Copy link
Owner

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
Copy link

@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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants