Open tahnaconus opened 6 years ago
Looks like you have 2 connections. Can you post arduino code?
ya, i have 2 connections. 1 internet explorer, 1 esp8266. my code:
extern "C" {
}
float timer0,timer1; int counterDisconnect;
SocketIOClient socket; const char ssid = "Tenda_42D9C0"; const char password = "12345678"; char host[] = "192.168.0.108"; int port = 3000;
extern String RID; extern String Rname; extern String Rcontent;
void setup() {
Wire.begin();
Wire.setClockStretchLimit(150000);
Serial.begin(115200);
Serial.println("ESP8266 Websocket Client");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("ket noi thanh cong");
Serial.println(WiFi.localIP());
Serial.setTimeout(100);
while (!socket.connect(host, port)) {
Serial.println(F("Ket noi den socket server that bai!"));
delay(2000);
}
Serial.println("Join Server thanh cong");
delay(500);
socket.send("arduino_join","0","0");
void loop() { if(socket.connected()){ if(socket.monitor()){ String nana=Rcontent; Serial.println(nana); } } else{ socket.reconnect(host, port); Serial.println("reconnect"); counterDisconnect++; socket.send("arduino_join","0","0"); }
if(millis()-timer0 >10){ timer0=millis(); static int m=0,n=0,b=0; m++;n++;b++; if(m>50000) m=0; if(n>5000) n=0; if(b>500) b=0; String cs=""; cs+=String(m); socket.send("a-e","O",cs);
} }
I'm not sure, but I have to make also a game controlled through arduino so lagging is no option. I think I have found a nice compromise by calling the monitor() function only every 30s. Another thing I noticed (but might be completely not true) is that having the monitor function and a lot of messages sent to Serial slowed things down.
Hi, I trying to use your library send and receive data 10ms/times and get some problem: esp8266 lagging like video https://youtu.be/DKr2FgKOwdg. I dont know how to fix it. I need some help, many thanks