File tree Expand file tree Collapse file tree 3 files changed +51
-39
lines changed
Expand file tree Collapse file tree 3 files changed +51
-39
lines changed Original file line number Diff line number Diff line change 1- #include " Client .h"
1+ #include " ClientApp .h"
22#include < iostream>
33
44int 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}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments