-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Hi. I'm trying to reimplement server logic from Flask to oat++ and have stopped at a problem with server response. I need the server to send a response after the WebSocket has been established. I tried to do it here:
cpp
void WSInstanceListener::onAfterCreate_NonBlocking(const std::shared_ptrWSListener::AsyncWebSocket& socket, const std::shared_ptr& params) {
SOCKETS++;
oatpp::String deviceId;
if (params && params->find("device_id") != params->end()) {
deviceId = params->at("device_id");
} else {
deviceId = "";
}
socket->setListener(std::make_shared<WSListener>(deviceId, socket));
OATPP_LOGd(TAG, "New Incoming Connection. Connection count={}", SOCKETS.load());
socket->sendOneFrameTextAsync("Server resp "); // <---------- HERE
}
But it doesn't send anything. Is it possible to do this somewhere else? Or is it possible to set a one-time callback to send the response?
Metadata
Metadata
Assignees
Labels
No labels