washo4evr / Socket.io-v1.x-Library

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

Getting 400 error #44

Closed maxdonadio closed 7 years ago

maxdonadio commented 7 years ago

I'm getting a 400 error from the "hello-time" example, here's my code, I just changed my IP and the port:

#include "SocketIOClient.h"
#include "Ethernet.h"
#include "SPI.h"

SocketIOClient client;

byte mac[] = { 0xAA, 0x00, 0xBE, 0xEF, 0xFE, 0xEE };
char hostname[] = "10.114.80.107";
int port = 80;

extern String RID;
extern String Rname;
extern String Rcontent;

unsigned long previousMillis = 0; 
long interval = 10000; 
void setup() {
  Serial.begin(9600);

  Ethernet.begin(mac);

  if (!client.connect(hostname, port))
    Serial.println(F("Not connected."));
  if (client.connected())
  {
    client.send("connection", "message", "Connected !!!!");
  }

  else
  {
    Serial.println("Connection Error");
   while(1);
  }
  delay(1000);
}

void loop()
{
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval)
  {
    previousMillis = currentMillis; 
    //client.heartbeat(0);
    client.send("atime", "message", "Time please?");
  }
  if (client.monitor())
  {
    Serial.println(RID);
    if (RID == "atime" && Rname == "time")
    {
      Serial.print("Time is ");
      Serial.println(Rcontent);
    }
  }
}

Here's the message: 2017-08-15 1

Please help :(

maxdonadio commented 7 years ago

It was my network