Fix recent build
This commit is contained in:
+15
-11
@@ -1,16 +1,20 @@
|
||||
#include "Client.h"
|
||||
#include "ClientApp.h"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
uWS::Client({
|
||||
.open = [](/*auto *ws*/) {
|
||||
std::cout << "Hello and welcome to client" << std::endl;
|
||||
},
|
||||
.message = [](/*auto *ws, auto message*/) {
|
||||
uWS::ClientApp app({
|
||||
.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();
|
||||
},
|
||||
.close = [](/*auto *ws*/) {
|
||||
std::cout << "bye" << std::endl;
|
||||
}
|
||||
});
|
||||
|
||||
app.connect("ws://localhost:3000", "protocol");
|
||||
|
||||
app.run();
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#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() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "MoveOnlyFunction.h"
|
||||
#include "WebSocketContext.h"
|
||||
#include <string>
|
||||
|
||||
namespace uWS {
|
||||
|
||||
struct WebSocketClientBehavior {
|
||||
MoveOnlyFunction<void()> open;
|
||||
MoveOnlyFunction<void()> message;
|
||||
MoveOnlyFunction<void()> close;
|
||||
//MoveOnlyFunction<void()> failed;
|
||||
|
||||
};
|
||||
|
||||
struct ClientApp {
|
||||
|
||||
WebSocketContext<0, false, int> *webSocketContext;
|
||||
// behöver ett nytt http context med minimal klient, som slår om till den riktiga websocketcontext
|
||||
// om samma storlek på httpsocket och websocket blir det enkel övergång
|
||||
|
||||
ClientApp(WebSocketClientBehavior &&behavior) {
|
||||
//webSocketContext = WebSocketContext<0, false, int>::create();
|
||||
}
|
||||
|
||||
ClientApp &&connect(std::string url, std::string protocol = "") {
|
||||
|
||||
return std::move(*this);
|
||||
}
|
||||
|
||||
void run() {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user