You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In file included from c:\Users\diego\OneDrive\Documentos\Arduino\libraries\ArduinoWebsockets\src/ArduinoWebsockets.h:6:0,
from D:\github projects\Arduino\websocket\websocket.ino:2:
c:\Users\diego\OneDrive\Documentos\Arduino\libraries\ArduinoWebsockets\src/tiny_websockets/server.hpp:10:40: error: expected ')' before '*' token
WebsocketsServer(network::TcpServer* server = new WSDefaultTcpServer);
^
c:\Users\diego\OneDrive\Documentos\Arduino\libraries\ArduinoWebsockets\src/tiny_websockets/server.hpp:26:14: error: 'TcpServer' in namespace 'websockets::network' does not name a type
network::TcpServer* _server;
^~~~~~~~~
exit status 1
Compilation error: exit status 1
To Reproduce
Only verifying the code used
This should include:
The library version you are using: 0.5.4
The board you are using: arduino uno R4 WIFI
Information about other components in the system (do you use third party client/server software?)
Expected behavior
Subscribed to the topic 1
Code
#include "WiFiS3.h"
#include <ArduinoWebsockets.h>
#include "arduino_secrets.h" // Just a file to store secrets
char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;
int status = WL_IDLE_STATUS;
const char* websockets_server_host = "0.0.0.0:8000/ws/<token>";
using namespace websockets;
WebsocketsClient client;
void onMessageCallback(WebsocketsMessage message) {
Serial.print("Got Message: ");
Serial.println(message.data());
}
void onEventsCallback(WebsocketsEvent event, String data) {
if(event == WebsocketsEvent::ConnectionOpened) {
Serial.println("Connnection Opened");
} else if(event == WebsocketsEvent::ConnectionClosed) {
Serial.println("Connnection Closed");
} else if(event == WebsocketsEvent::GotPing) {
Serial.println("Got a Ping!");
} else if(event == WebsocketsEvent::GotPong) {
Serial.println("Got a Pong!");
}
}
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
delay(10000);
}
printWifiStatus();
client.connect(websockets_server_host);
client.send("{\"topic\": \"topic1\", \"content\": \"Subscribing to topic1\"}");
client.onMessage(handleMessage);
}
void loop() {
client.poll();
}
void handleMessage(WebsocketsMessage message) {
Serial.print("Received message: ");
Serial.println(message.data());
}
void printWifiStatus() {
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
receive this error:
To Reproduce
Only verifying the code used
This should include:
Expected behavior
Subscribed to the topic 1
Code
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: