Skip to content

Commit 526a9ad

Browse files
committed
Fix recent build
1 parent ca8d620 commit 526a9ad

File tree

3 files changed

+51
-39
lines changed

3 files changed

+51
-39
lines changed

examples/Client.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
#include "Client.h"
1+
#include "ClientApp.h"
22
#include <iostream>
33

44
int main() {
5-
uWS::Client({
6-
.open = [](/*auto *ws*/) {
7-
std::cout << "Hello and welcome to client" << std::endl;
8-
},
9-
.message = [](/*auto *ws, auto message*/) {
5+
uWS::ClientApp app({
6+
.open = [](/*auto *ws*/) {
7+
std::cout << "Hello and welcome to client" << std::endl;
8+
},
9+
.message = [](/*auto *ws, auto message*/) {
1010

11-
},
12-
.close = [](/*auto *ws*/) {
13-
std::cout << "bye" << std::endl;
14-
}
15-
}).connect("ws://localhost:3000").run();
11+
},
12+
.close = [](/*auto *ws*/) {
13+
std::cout << "bye" << std::endl;
14+
}
15+
});
16+
17+
app.connect("ws://localhost:3000", "protocol");
18+
19+
app.run();
1620
}

src/Client.h

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/ClientApp.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "MoveOnlyFunction.h"
2+
#include "WebSocketContext.h"
3+
#include <string>
4+
5+
namespace uWS {
6+
7+
struct WebSocketClientBehavior {
8+
MoveOnlyFunction<void()> open;
9+
MoveOnlyFunction<void()> message;
10+
MoveOnlyFunction<void()> close;
11+
//MoveOnlyFunction<void()> failed;
12+
13+
};
14+
15+
struct ClientApp {
16+
17+
WebSocketContext<0, false, int> *webSocketContext;
18+
// behöver ett nytt http context med minimal klient, som slår om till den riktiga websocketcontext
19+
// om samma storlek på httpsocket och websocket blir det enkel övergång
20+
21+
ClientApp(WebSocketClientBehavior &&behavior) {
22+
//webSocketContext = WebSocketContext<0, false, int>::create();
23+
}
24+
25+
ClientApp &&connect(std::string url, std::string protocol = "") {
26+
27+
return std::move(*this);
28+
}
29+
30+
void run() {
31+
32+
}
33+
34+
};
35+
36+
}

0 commit comments

Comments
 (0)