mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
Add websocket class
This commit is contained in:
+35
-1
@@ -1,5 +1,39 @@
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "simulators.hpp"
|
||||
#include "websocket.hpp"
|
||||
|
||||
Simulators simulators;
|
||||
Websocket* g_web_socket;
|
||||
|
||||
void int_handler(int s)
|
||||
{
|
||||
UNUSED(s);
|
||||
std::cout << "\nCaught Ctrl + C\nShutting down." << std::endl;
|
||||
g_web_socket->stop();
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
struct sigaction sigIntHandler;
|
||||
|
||||
sigIntHandler.sa_handler = int_handler;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
Websocket web_socket(9002, [](std::string message) {
|
||||
return message;
|
||||
});
|
||||
g_web_socket = &web_socket;
|
||||
web_socket.run();
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user