我正在开发一个需要在客户端和服务器之间建立Websockets的系统。我按照这个例子:
https://github.com/krohling/ArduinoWebsocketClient
回显服务器未回复。这是我的代码:
#include "Arduino.h"
#include <Ethernet.h>
#include <SPI.h>
#include <WebSocketClient.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "echo.websocket.org";
WebSocketClient client;
void setup() {
Serial.begin(9600);
Ethernet.begin(mac);
client.connect(server);
client.setDataArrivedDelegate(dataArrived);
client.send("Hello World!");
}
void loop() {
client.monitor();
}
void dataArrived(WebSocketClient client, String data) {
Serial.println("Data Arrived: " + data);
}
有人可以告诉我为什么这不起作用吗?