Skip to content

argument error on WebSocketsClient::beginSSL. with the default example.  #101

@ebadfd

Description

@ebadfd

Hi, i been trying to connect to a socket.io server using this library. and im facing a issue. below is the complete stack trace

Arduino: 1.8.19 (Linux), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"


/home/dasith/Arduino/libraries/SocketIoClient/SocketIoClient.cpp: In member function 'void SocketIoClient::beginSSL(const char*, int, const char*, const char*)':
/home/dasith/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:46:39: error: invalid conversion from 'const char*' to 'const uint8_t*' {aka 'const unsigned char*'} [-fpermissive]
   46 |  _webSocket.beginSSL(host, port, url, fingerprint);
      |                                       ^~~~~~~~~~~
      |                                       |
      |                                       const char*
In file included from /home/dasith/Arduino/libraries/SocketIoClient/SocketIoClient.h:7,
                 from /home/dasith/Arduino/libraries/SocketIoClient/SocketIoClient.cpp:1:
/home/dasith/Arduino/libraries/WebSockets-2.3.6/src/WebSocketsClient.h:50:93: note:   initializing argument 4 of 'void WebSocketsClient::beginSSL(const char*, uint16_t, const char*, const uint8_t*, const char*)'
   50 |     void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
      |                                                                                             ^
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

it seems like a issue with conversion and my code is almost the default example. i have attached it below.

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <SocketIoClient.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti;
SocketIoClient webSocket;

void event(const char * payload, size_t length) {
  USE_SERIAL.printf("got message: %s\n", payload);
}

void setup() {
    USE_SERIAL.begin(115200);

    USE_SERIAL.setDebugOutput(true);

    USE_SERIAL.println();
    USE_SERIAL.println();
    USE_SERIAL.println();

      for(uint8_t t = 4; t > 0; t--) {
          USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t);
          USE_SERIAL.flush();
          delay(1000);
      }

    WiFiMulti.addAP("SSID", "passpasspass");

    while(WiFiMulti.run() != WL_CONNECTED) {
        delay(100);
    }

    webSocket.on("event", event);
    webSocket.begin("my.socket-io.server");
}

void loop() {
    webSocket.loop();
}

thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions