mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
28 lines
554 B
C++
28 lines
554 B
C++
#include "Core/Core.h"
|
|
|
|
using namespace Upp;
|
|
|
|
// Open demo.html in browser, run this app, push the button...
|
|
|
|
CONSOLE_APP_MAIN
|
|
{
|
|
StdLogSetup(LOG_COUT|LOG_FILE);
|
|
|
|
TcpSocket server;
|
|
if(!server.Listen(8888)) {
|
|
LOG("Failed to start listening on 8888..");
|
|
return;
|
|
}
|
|
|
|
for(;;) {
|
|
TcpSocket socket;
|
|
WebSocket ws;
|
|
if(socket.Accept(server) && ws.WebAccept(socket)) {
|
|
LOG("Accepted connection");
|
|
LOG(ws.Recieve());
|
|
ws.SendText("Hello browser!");
|
|
}
|
|
if(ws.IsError())
|
|
LOG("ERROR: " << ws.GetErrorDesc());
|
|
}
|
|
}
|