Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle receiving messages in large sizes? #120

Open
Janecifer opened this issue Sep 6, 2022 · 2 comments
Open

How to handle receiving messages in large sizes? #120

Janecifer opened this issue Sep 6, 2022 · 2 comments

Comments

@Janecifer
Copy link

Janecifer commented Sep 6, 2022

Hi Marfusios,

Thanks for this great lib.
Mat I trouble you how to handle large messages? It works well in small sizes of data. But we have a situation that may receive the 10M data, then it will throw an Exception.

[ERR] [WEBSOCKET CLIENT] Error while listening to websocket stream, error: 'An exception caused the WebSocket to enter the Aborted state. Please see the InnerException, if present, for more details.'
System.Net.WebSockets.WebSocketException (0x80004005): An exception caused the WebSocket to enter the Aborted state. Please see the InnerException, if present, for more details.
at System.Net.WebSockets.ManagedWebSocket.CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus closeStatus, WebSocketError error, String errorMessage, Exception innerException)
at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory1 payloadBuffer, CancellationToken cancellationToken) at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token) at System.Threading.Tasks.ValueTask1.GetTaskForValueTaskSource(IValueTaskSource`1 t)
--- End of stack trace from previous location ---
at Websocket.Client.WebsocketClient.Listen(WebSocket client, CancellationToken token)

We try to add an option for increasing the buffer size, but it didn't help. _ clientFactory.Options.SetBuffer(20971520, 10240);

Thanks for help!

@Marfusios
Copy link
Owner

Hey @Janecifer ,
what is the InnerException?

@m17kea
Copy link

m17kea commented Sep 7, 2023

I have the same issue, the inner exception is null. The exception I have is:

   at System.Net.WebSockets.ManagedWebSocket.CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus closeStatus, WebSocketError error, String errorMessage, Exception innerException)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.GetTaskForValueTaskSource(IValueTaskSource`1 t)
--- End of stack trace from previous location ---
   at Websocket.Client.WebsocketClient.Listen(WebSocket client, CancellationToken token)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants