Add some initial client stuff
This commit is contained in:
@@ -9,7 +9,7 @@ int main(int argc, char **argv) {
|
||||
char *CXX = strcpy(calloc(1024, 1), or_else(getenv("CXX"), "g++"));
|
||||
char *EXEC_SUFFIX = strcpy(calloc(1024, 1), maybe(getenv("EXEC_SUFFIX")));
|
||||
|
||||
char *EXAMPLE_FILES[] = {"Http3Server", "Broadcast", "HelloWorld", "Crc32", "ServerName",
|
||||
char *EXAMPLE_FILES[] = {"Client", "Http3Server", "Broadcast", "HelloWorld", "Crc32", "ServerName",
|
||||
"EchoServer", "BroadcastingEchoServer", "UpgradeSync", "UpgradeAsync"};
|
||||
|
||||
strcat(CXXFLAGS, " -O3 -Wpedantic -Wall -Wextra -Wsign-conversion -Wconversion -std=c++2a -Isrc -IuSockets/src");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "Client.h"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
uWS::Client({
|
||||
.open = [](/*auto *ws*/) {
|
||||
std::cout << "Hello and welcome to client" << std::endl;
|
||||
},
|
||||
.message = [](/*auto *ws, auto message*/) {
|
||||
|
||||
},
|
||||
.close = [](/*auto *ws*/) {
|
||||
std::cout << "bye" << std::endl;
|
||||
}
|
||||
}).connect("ws://localhost:3000").run();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#include "MoveOnlyFunction.h"
|
||||
|
||||
namespace uWS {
|
||||
|
||||
struct WebSocketClientBehavior {
|
||||
MoveOnlyFunction<void()> open;
|
||||
MoveOnlyFunction<void()> message;
|
||||
MoveOnlyFunction<void()> close;
|
||||
};
|
||||
|
||||
struct Client {
|
||||
|
||||
Client(WebSocketClientBehavior &&behavior) {
|
||||
|
||||
}
|
||||
|
||||
Client &&connect(std::string url) {
|
||||
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
void run() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user