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

Question: Sudden availability of Webpage missing / No response from server #889

Open
hasenradball opened this issue Jul 10, 2024 · 3 comments

Comments

@hasenradball
Copy link
Contributor

hasenradball commented Jul 10, 2024

Dear @Links2004,

I use a ESP01 with you Library for an Webserver application.
I see sudden missing of Webpage availability.

I want to shortly discuss with you about th possible root cause.

May you have 5 min to have a look to may code if you see some wrong implementation of my code?

Kind Regards
Frank

@hasenradball hasenradball changed the title Question: Sudden reboots of ESP01 Question: Sudden availability of Webpage missing Nov 25, 2024
@hasenradball
Copy link
Contributor Author

My configuration looks like this.
Is this fine from your point of view?

void webSocketEvent(uint8_t client_id, WStype_t type, uint8_t *payload, __attribute__((unused)) size_t length) {

  switch (type) {
      case WStype_DISCONNECTED:
        dprintf("[%u] Disconnected!\n", client_id);
        break;
      
      case WStype_CONNECTED:
        {
          IPAddress ip = webSocket.remoteIP(client_id);
          dprintf("[%u] Connected from %d.%d.%d.%d url: %s\n", client_id, ip[0], ip[1], ip[2], ip[3], payload);

          // send message to client
          //webSocket.sendTXT(client_id, "Connected");
        }
        break;

      case WStype_TEXT:
        {
          StaticJsonDocument<96> doc;
          dprintf("[%u] get Text: %s\n", client_id, payload);

          DeserializationError error = deserializeJson(doc, payload);
          if (error) {
            DBG__PRINT(F(">>> ERROR: Failed to read file, using default configuration!"));
          }
          else {
            if (doc.containsKey("Connect")) {
              __attribute__((unused)) const char *connection_info = doc["Connect"];
            }
            const char *relais_str = doc["Relais"];
            char relais_request = relais_str ? relais_str[0] : 0;
            DBG__PRINT("Relais-Request: ", relais_request);
            handle_Request(relais_request, client_id);
          }
        }
        break;

      case WStype_FRAGMENT_TEXT_START:
        break;
      
      case WStype_BIN:
        break;
      
      case WStype_FRAGMENT_BIN_START:
        break;
      
      case WStype_FRAGMENT:
        break;
      
      case WStype_FRAGMENT_FIN:
        break;
      
      case WStype_PING:
        break;
      
      case WStype_PONG:
        break;

      default:
        break;
  }
}

@hasenradball
Copy link
Contributor Author

maybee same issue at #871

@hasenradball hasenradball changed the title Question: Sudden availability of Webpage missing Question: Sudden availability of Webpage missing / No response from server Nov 25, 2024
@hasenradball
Copy link
Contributor Author

Just a Question.

Is this webSocket.sendTXT("Connected"); needed?
In my code I commented this line.


    case WStype_CONNECTED:
      Serial.println("[WSc] Connected!");

      // send message to server when Connected
      //webSocket.sendTXT(client_id, "Connected");

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

1 participant