本文整理汇总了C++中HttpServer::setWebSocketConnectionHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpServer::setWebSocketConnectionHandler方法的具体用法?C++ HttpServer::setWebSocketConnectionHandler怎么用?C++ HttpServer::setWebSocketConnectionHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpServer
的用法示例。
在下文中一共展示了HttpServer::setWebSocketConnectionHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startWebServer
void startWebServer()
{
server.listen(80);
server.addPath("/", onIndex);
server.addPath("/lcd", onLcd);
server.addPath("/volume", onVolume);
server.addPath("/mute", onMute);
server.addPath("/source", onSource);
server.addPath("/state", onState);
server.addPath("/power", onPower);
server.addPath("/tune", onTune);
server.addPath("/mixing", onMixing);
server.addPath("/enhance", onEnhance);
// Web Sockets configuration
server.enableWebSockets(true);
server.setWebSocketConnectionHandler(wsConnected);
server.setWebSocketMessageHandler(wsMessageReceived);
server.setWebSocketBinaryHandler(wsBinaryReceived);
server.setWebSocketDisconnectionHandler(wsDisconnected);
server.setDefaultHandler(onFile);
Serial.println("\r\n=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());
lcd.clear();
lcd.setCursor(1,1);
lcd.print(WifiStation.getIP());
}
示例2: StartServers
void StartServers()
{
server.listen(80);
server.addPath("/", onIndex);
server.setDefaultHandler(onFile);
// Web Sockets configuration
server.enableWebSockets(true);
server.commandProcessing(true,"command");
server.setWebSocketConnectionHandler(wsConnected);
server.setWebSocketMessageHandler(wsMessageReceived);
server.setWebSocketBinaryHandler(wsBinaryReceived);
server.setWebSocketDisconnectionHandler(wsDisconnected);
Serial.println("\r\n=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());
Serial.println("==============================\r\n");
// Start FTP server
ftp.listen(21);
ftp.addUser("me", "123"); // FTP account
Serial.println("\r\n=== FTP SERVER STARTED ===");
Serial.println("==============================\r\n");
telnet.listen(23);
telnet.enableDebug(true);
Serial.println("\r\n=== TelnetServer SERVER STARTED ===");
Serial.println("==============================\r\n");
}
示例3: startWebServer
void startWebServer()
{
server.listen(80);
server.addPath("/", onIndex);
server.setDefaultHandler(onFile);
// Web Sockets configuration
server.enableWebSockets(true);
server.setWebSocketConnectionHandler(wsConnected);
server.setWebSocketMessageHandler(wsMessageReceived);
server.setWebSocketBinaryHandler(wsBinaryReceived);
server.setWebSocketDisconnectionHandler(wsDisconnected);
Serial.println("\r\n=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());
Serial.println("==============================\r\n");
}