QWebSocket: difference between textMessageReceived and textFrameReceived ?
-
I've been trying out Qt's WebSockets implementation with a small client-server example similar to the Echo Client and Echo Server in Qt WebSocket examples page, and I've noticed that at least in some circumstances
textMessageReceivedandtextFrameReceivedare fired with the exact same content. However, the documentation is very scarce in details such as if both signals are emitted redundantly or if there is a limit on the string size passed throughtextMessageReceived, or in what conditions istextMessageReceivedemitted. Does anyone know if there is any information on how and why these signals are fired, and when it's safe to ignore one and just listen for another?Edit: after browsing
QWebSocket's source code, it appears thattextMessageReceivedandtextFrameReceivedpass redundant information, with the notable difference thattextMessageReceivedis emitted whentextFrameReceivedis emitted with the last frame. -
I've been trying out Qt's WebSockets implementation with a small client-server example similar to the Echo Client and Echo Server in Qt WebSocket examples page, and I've noticed that at least in some circumstances
textMessageReceivedandtextFrameReceivedare fired with the exact same content. However, the documentation is very scarce in details such as if both signals are emitted redundantly or if there is a limit on the string size passed throughtextMessageReceived, or in what conditions istextMessageReceivedemitted. Does anyone know if there is any information on how and why these signals are fired, and when it's safe to ignore one and just listen for another?Edit: after browsing
QWebSocket's source code, it appears thattextMessageReceivedandtextFrameReceivedpass redundant information, with the notable difference thattextMessageReceivedis emitted whentextFrameReceivedis emitted with the last frame.@rmam
A websocket data transfer contains of so called "frames". I can't tell you right now if QtWebSockets also does framing, or is simply using a single frame. But it may be needed if you let "3rd party" servers/clients connect to your application.See also framing in the WebSocket protocol standard
-
Thanks for the input, @raven-worx . Appreciate it.