#include <WiFiClient.h> #include <Pushsafer.h> what kind of data-transmission is this?

Hello everybody,

currently I'm testing the PushSafer-Service.
This is a service you have to pay for per notification and allows to send push-notifications to smartphones, browsers etc..

I want to use PushSafer at a place where on WLAN/WiFi only surfing with browsers is possible
Sending Emails with Email-Clients like Thunderbird etc. is blocked. I guess because the ports used for emails are closed.

The demo-code is pretty short.
Connect to WiFi
create client
setup event-details
call pushsafer.sendEvent()

#include <WiFi.h>
/*#include <WiFiClientSecure.h>*/
#include <WiFiClient.h>
#include <Pushsafer.h>

// Initialize Wifi connection to the router
char ssid[] = "";     // your network SSID (name)
char password[] = ""; // your network key

// Pushsafer private or alias key
#define PushsaferKey ""

/*WiFiClientSecure client;*/
WiFiClient client;
Pushsafer pushsafer(PushsaferKey, client);

void setup() {
  Serial.begin(115200);
  Serial.println("Setup-Start");

  // Set WiFi to station mode and disconnect from an AP if it was Previously
  // connected
  WiFi.mode(WIFI_STA);
  WiFi.disconnect();
  delay(100);

  // Attempt to connect to Wifi network:
  Serial.print("Connecting Wifi: ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  pushsafer.debug = true;

  // Take a look at the Pushsafer.com API at
  // https://www.pushsafer.com/en/pushapi
  
  struct PushSaferInput input;
  input.message = "I'm the test message";
  input.title = "Hello!";
  input.sound = "8";
  input.vibration = "1";
  input.icon = "1";
  input.iconcolor = "#FFCCCC";
  input.priority = "1";
  input.device = "a";
  input.url = "https://www.pushsafer.com";
  input.urlTitle = "Open Pushsafer.com";
  input.picture = "";
  input.picture2 = "";
  input.picture3 = "";
  input.time2live = "";
  input.retry = "";
  input.expire = "";
  input.answer = "";

  Serial.println(pushsafer.sendEvent(input));
  Serial.println("Sent");
  
  // client.stop();
}

void loop() {

I started looking into the source-code of the PushSafer-library

Even the PushSafer-library is pretty short

I guess the main thing about sending the data to pushsafer.com are these lines

    client->print("POST /api"); client->println(" HTTP/1.1");
    // Host header
    client->print("Host: "); client->println(HOST);
    client->println("User-Agent: arduino/1.0");
    client->println("Accept: */*");

    int contentLength = start_request.length() + end_request.length();
    if (debug) Serial.println("Content-Length: " + String(contentLength));
    client->print("Content-Length: "); client->println(String(contentLength));
    client->println("Content-Type: multipart/form-data; boundary=" + boundary);
    client->println("");

    client->print(start_request);

    if (debug) Serial.print(start_request);

    client->print(end_request);
    if (debug) Serial.print(end_request);

    now=millis();
    bool finishedHeaders = false;
    bool currentLineIsBlank = true;
    while (millis()-now<5000) {
      while (client->available()) {
        if (debug) Serial.println("response");
        char c = client->read();
        responseReceived=true;

So my question is:
As at the place I want to use an ESP32 with PushSafer only allows browsing (I guess http/https on port 80 and port 8080) and nothing else

Does this kind of sending data to PushSafer work the same way as browsing
= will work in a WiFi-WLAN where only browsing is possible?

I am very thankful for any kind of tips or hints how to determine what kind of "sending data"
protocol (HTTP, FTP, TCP, UDP) , method "POST" or "GET" or whatever and ports are used by PushSafer.

best regards Stefan

Looking at the library's source code, it appears that only Port 80 is used. So, if that's the only restriction imposed by the WiFi network being joined, it will likely work.

Easiest way to find out would be to try it.

Hi gfvalvo,
thank you very much for answering.

Ah! OK. I found it in the PushSafer.h

/*#define SSL_PORT 443*/
#define PORT 80

Yes seems very likely to work

is the port 443 used for https ? or is https something different than "SSL"

There's quite a list:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.