Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By suttop1
#93645 I have a basic websocket code I have used for several years between 8266 d1 minis. I want to use it between d1 mini and a generic 8285 board but when I try the websocket will not connect. I have tried several different boards with the same result. the 8285 is running as client to an 8266 in softap mode running as websocket server.
I am using aurdino IDE.
this is the client end code ( its just a test routine.)

Code: Select all#include <Arduino.h>
#include <ESP8266WiFi.h>
//#include <ESP8266WiFiMulti.h>
 #include <WebSocketsClient.h>
//#include <Hash.h>
IPAddress remoteip(192,168,4,1);
//ESP8266WiFiMulti WiFiMulti;
WebSocketsClient webSocket;

 static uint8_t bssid[]{0xA8, 0x48, 0xFA, 0xDC, 0xAC, 0xB8};
const char *ssid = "Universal";         //Name of the access point
const char *password = "lo******te";    //Password for the access point

IPAddress local_IP(192,168,8,22);
IPAddress gateway(192,168,8,9);
IPAddress subnet(255,255,255,0);

void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
  switch(type) {
    case WStype_DISCONNECTED:
      Serial.printf("[WSc] Disconnected!\n");
    case WStype_CONNECTED: {
      Serial.printf("[WSc] Connected to url: %s\n", payload);
      // send message to server when Connected
    case WStype_TEXT:
      Serial.printf("[WSc] get text: %s\n", payload);
    case WStype_BIN:
       Serial.printf("bin recieved");Serial.println("");
        case WStype_PING:
            Serial.printf("[WSc] get ping\n");
        case WStype_PONG:
             Serial.printf("[WSc] get pong\n");

void setup()

//  Serial.print("Setting soft-AP configuration ... ");
//  Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");

 // Serial.print("Setting soft-AP ... ");
//  Serial.println(WiFi.softAP("ESPsoftAP_01") ? "Ready" : "Failed!");

//  Serial.print("Soft-AP IP address = ");
//  Serial.println(WiFi.softAPIP());
//  WiFi.begin(ssid, password,11, bssid, true);
   WiFi.begin(ssid, password);
  while (WiFi.status() != 3)
  webSocket.begin("", 701, "/");
  // event handler
 // try ever 5000 again if connection has failed
  // start heartbeat (optional)
  // ping server every 15000 ms
  // expect pong from server within 3000 ms
  // consider connection disconnected if pong is not received 2 times
  webSocket.enableHeartbeat(15000, 3000, 2);

void loop(){

run on 8266 it gives :-
7777773[WSc] Connected to url: /
[WSc] get ping
bin recieved
[WSc] get pong
[WSc] get pong
bin recieved
bin recieved
bin recieved

But on the 8285 with the same 8266 as server it gives:-
and does not connect.
status 1 is no ssid found
the signal strength is very good (-25db) on both d1 mini and 8285 ( I use a 5/8 dipole as standard.)
I have completely run out of ideas. Any help gladly received.