#include <WiFi.h>
#include <WebSocketsClient.h>
#include <ArduinoJson.h>
#include <driver/adc.h>
#include <HTTPClient.h>
#include <HardwareSerial.h>
const char* ssid = "464564";
const char* password = "546456.";
WebSocketsClient webSocket;
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
switch(type) {
case WStype_DISCONNECTED:
Serial.println("Disconnected from WebSocket server");
break;
case WStype_CONNECTED:
Serial.println("Connected to WebSocket server");
break;
case WStype_TEXT:
Serial.printf("Received payload: %s\n", payload);
break;
}
}
void setup(){
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
webSocket.beginSSL("iat-api.xfyun.cn",443,"/v2/iat?host=iat-api.xfyun.cn&date=Tue%2C+10+Sep+2024+06%3A43%3A55+GMT&authorization=BkYXRlIHJlcXVlc3QtbGluZSIsIHNpZ25hdbGN5WEtnY3lIQmRGTUFFcHl6NHNxRT0i");
webSocket.onEvent(webSocketEvent);
}
void loop() {
webSocket.loop();
}
/v2/iat?host=iat-api.xfyun.cn&date=Tue%2C+10+Sep+2024+06%3A43%3A55+GMT&authorization=BkYXRlIHJlcXVlc3QtbGluZSIsIHNpZ25hdbGN5WEtnY3lIQmRGTUFFcHl6NHNxRT0i是你的鉴权链接