You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement a one-way websocket endpoint that sends a never-ending stream of frames from the server to the client as soon as the connection is open and as soon as new data is available from some other part of the application.
I have searched through the oatpp websocket examples, and I have not found anything similar. All the examples seem to assume that the client initiates the communication, and all the frames sent from the server to the client are in "response" to a client frame.
It seems that server-initiated frames are not supported with the current oatpp-websocket framework. It looks like what I would need is to provide my own implementation of Task::run() inside oatpp::websocket::ConnectionHandler::handleConnection:
Another way to achieve this kind of one-way stream would be to use the asynchronous API, and have an external thread send tasks to the appropriate Executor or Processor; the one running the corresponding AsyncWebSocket::Listener coroutine, I guess.
These tasks would simply call AsyncWebSocket::sendOneFrameAsync. But for that they would need to have access to the internal AsyncWebSocket object, and I can not find a way to get access to it.
Bad news, even having access to the AsyncWebSocket object doing sendOneFrameAsync doesn't seem to actually execute. Theres more stuff you have to do that I'm trying to figure out myself. There really is no point to having websockets if the server can't initiate a connection.
I am trying to implement a one-way websocket endpoint that sends a never-ending stream of frames from the server to the client as soon as the connection is open and as soon as new data is available from some other part of the application.
I have searched through the oatpp websocket examples, and I have not found anything similar. All the examples seem to assume that the client initiates the communication, and all the frames sent from the server to the client are in "response" to a client frame.
It seems that server-initiated frames are not supported with the current oatpp-websocket framework. It looks like what I would need is to provide my own implementation of Task::run() inside oatpp::websocket::ConnectionHandler::handleConnection:
oatpp-websocket/src/oatpp-websocket/ConnectionHandler.cpp
Line 70 in d95c8ee
Is there any other way to achieve this? Or is this maybe a feature planned for the future?
The text was updated successfully, but these errors were encountered: