diff --git a/src/main.cpp b/src/main.cpp index 36c9cd7a..07295d5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,7 +71,7 @@ int main() { // MPC is initialized here! MPC mpc; - h.onMessage([&mpc](uWS::WebSocket ws, char *data, size_t length, + h.onMessage([&mpc](uWS::WebSocket *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 @@ -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); } } }); @@ -164,13 +164,13 @@ int main() { } }); - h.onConnection([&h](uWS::WebSocket ws, uWS::HttpRequest req) { + h.onConnection([&h](uWS::WebSocket *ws, uWS::HttpRequest req) { std::cout << "Connected!!!" << std::endl; }); - h.onDisconnection([&h](uWS::WebSocket ws, int code, + h.onDisconnection([&h](uWS::WebSocket *ws, int code, char *message, size_t length) { - ws.close(); + ws->close(); std::cout << "Disconnected" << std::endl; });