Large payload websocket close

98 views
Skip to first unread message

Deval Gupta

unread,
May 9, 2023, 5:19:24 PM5/9/23
to WebSocket++
Hello,

I am using the websocketpp client, and I have noticed that I get the 

Socket Closed: close code: 1006 (Abnormal close)

when I am sending large payloads over the websocket. I ensured that I don't send anything over the payload limit, and I have increased my pong timeout to 2 minutes, and don't close the socket connection on my side. And I have confirmed that the server side also does not close it. My searches on the internet seem to indicate that a 1006 is a lower level error. 

Is there a timeout I can modify that is causing my socket connect to close while I am sending a message? Because of this issue, my message never gets to the server and this information is critical to my application.

For context, I am using a cellular modem to transmit data so the time it takes to transmit data may be slower. 

Jacob Burckhardt

unread,
May 9, 2023, 6:49:44 PM5/9/23
to WebSocket++, Deval Gupta
You might want to enable logging:



From: 'Deval Gupta' via WebSocket++ <webso...@googlegroups.com>
Sent: Tuesday, May 9, 2023 2:19 PM
To: WebSocket++ <webso...@googlegroups.com>
Subject: Large payload websocket close
 
--
You received this message because you are subscribed to the Google Groups "WebSocket++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to websocketpp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/websocketpp/414fa6c2-a937-4375-bf3e-0082d03a99cbn%40googlegroups.com.

Deval Gupta

unread,
May 9, 2023, 7:03:27 PM5/9/23
to WebSocket++
I have this set in my code already.

m_endpoint.clear_access_channels(websocketpp::log::alevel::all);
m_endpoint.clear_error_channels(websocketpp::log::elevel::all);

Is there something specific I can look at to see where the error is coming from?

Jacob Burckhardt

unread,
May 9, 2023, 7:37:57 PM5/9/23
to WebSocket++, Deval Gupta

shows the same logging configuration code that you have, but that link says that code does this:
First, we set the endpoint logging behavior to silent by clearing all of the access and error logging channels.
I.e. it makes logging silent.  I think you want to change "clear" to "set" on both lines.


From: 'Deval Gupta' via WebSocket++ <webso...@googlegroups.com>
Sent: Tuesday, May 9, 2023 4:03 PM
To: WebSocket++ <webso...@googlegroups.com>
Subject: Re: Large payload websocket close
 

Deval Gupta

unread,
May 9, 2023, 7:59:30 PM5/9/23
to WebSocket++
Oh I see. Yeah that makes sense. Appreciate that!

Okay, so I did that and I ran my application and I see this error when the large payload is sent. 

[2023-05-09 23:55:26] [error] handle_read_frame error: websocketpp.transport:7 (End of File)
[2023-05-09 23:55:31] [disconnect] Disconnect close local:[1006,End of File] remote:[1006]
[2023-05-09 23:55:31] [info] asio async_write error: system:125 (Operation canceled)
[2023-05-09 23:55:31] [fatal] handle_write_frame error: websocketpp.transport:2 (Underlying Transport Error)

Any ideas on how to fix it? Or is it saying this is a limitation of my hardware internet interface. 

Because immediately after my application is able re-open the socket connection without any issues, so I know its not an internet pipe issue.

Jacob Burckhardt

unread,
May 9, 2023, 9:11:24 PM5/9/23
to WebSocket++, Deval Gupta
I searched the bug reports on GitHub.  I found some with similar error messages like:


and don't close the socket connection on my side. And I have confirmed that the server side also does not close it. 
Even though you said neither side closed, "End of File" probably means someone closed.  You might want to double-check if there is a close by using Wireshark.  Try to find out which side first sent FIN or RST.



From: 'Deval Gupta' via WebSocket++ <webso...@googlegroups.com>
Sent: Tuesday, May 9, 2023 4:59 PM

Damon chen

unread,
Jun 16, 2023, 12:10:11 PM6/16/23
to WebSocket++
HI , any progress of this issue? 
I also encounter this issue, and I add some trace log and found that when I send a large message such as 1MB, and the error code show  "Invalid UTF8 encoding";
I used the websocket version 0.8.2,  and with asio standalone mode. asio version: (https://github.com/chriskohlhoff/asio.git , HEAD detached at 14db6371) .
And if I change the asio version to the (HEAD detached at asio-1-24-0), then every thing works well.
Reply all
Reply to author
Forward
0 new messages