Switching relay with multiple ESP8266

Hello,
I would like to use three ESP8266 clients to switch on relay shield in fourth ESP8266. The relay needs to be switched on when any of clients will be active (powered on). At a given time any of client/s can be working. All my EPS8266 are Wemos D1 mini boards.

For now I'm using simple code on all clients and AP which gives me proper functionality, but I have problems when connected client is turning off and new one is connecting. When this happens, relay is switching off and there is few seconds of delay, before it turns on back again.

Can multiple clients can be connected at the same time to one AP? If not, can client send command to switch on relay for some time and disconnect from AP leaving free space for new client to connect?

AP code:

#include <ESP8266WiFi.h>

byte relay = D1;
char ssid[] = "Wemos_AP";           // SSID of your AP
char pass[] = "Wemos_comm";         // password of your AP

IPAddress server(192,168,4,15);     // IP address of the AP
WiFiClient client;

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, pass);           // connects to the WiFi AP
  Serial.println();
  Serial.println("Connection to the AP");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.println("Connected");
  Serial.println("station_bare_01.ino");
  Serial.print("LocalIP:"); Serial.println(WiFi.localIP());
  Serial.println("MAC:" + WiFi.macAddress());
  Serial.print("Gateway:"); Serial.println(WiFi.gatewayIP());
  Serial.print("AP MAC:"); Serial.println(WiFi.BSSIDstr());
  pinMode(relay, OUTPUT);
}

void loop() {

  if (client.connect(server, 80)) {
    Serial.println("Connected");
    digitalWrite(relay, HIGH);
     
  } else {
    Serial.println("Disconnected");
    digitalWrite(relay, LOW);
  }
 
}

Client code:

#include <ESP8266WiFi.h>

WiFiServer server(80);
IPAddress IP(192,168,4,15);
IPAddress mask = (255, 255, 255, 0);

void setup() {
 
}

void loop() {
 Serial.begin(115200);
  WiFi.mode(WIFI_AP);
  WiFi.softAP("Wemos_AP", "Wemos_comm");
  WiFi.softAPConfig(IP, IP, mask);
  server.begin();
   
}

Yes, multiple clients can connect to one AP.

Your code confuses me. The client code seems to set up an AP.