Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Fixed uWebSocket method signatures mismatch #3

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main() {
// MPC is initialized here!
MPC mpc;

h.onMessage([&mpc](uWS::WebSocket<uWS::SERVER> ws, char *data, size_t length,
h.onMessage([&mpc](uWS::WebSocket<uWS::SERVER> *ws, char *data, size_t length,
uWS::OpCode opCode) {
// "42" at the start of the message means there's a websocket message event.
// The 4 signifies a websocket message
Expand Down Expand Up @@ -140,12 +140,12 @@ int main() {
// NOTE: REMEMBER TO SET THIS TO 100 MILLISECONDS BEFORE
// SUBMITTING.
this_thread::sleep_for(chrono::milliseconds(100));
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
ws->send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
} else {
// Manual driving
std::string msg = "42[\"manual\",{}]";
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
ws->send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
}
});
Expand All @@ -164,13 +164,13 @@ int main() {
}
});

h.onConnection([&h](uWS::WebSocket<uWS::SERVER> ws, uWS::HttpRequest req) {
h.onConnection([&h](uWS::WebSocket<uWS::SERVER> *ws, uWS::HttpRequest req) {
std::cout << "Connected!!!" << std::endl;
});

h.onDisconnection([&h](uWS::WebSocket<uWS::SERVER> ws, int code,
h.onDisconnection([&h](uWS::WebSocket<uWS::SERVER> *ws, int code,
char *message, size_t length) {
ws.close();
ws->close();
std::cout << "Disconnected" << std::endl;
});

Expand Down