-
Notifications
You must be signed in to change notification settings - Fork 347
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
InvalidAccessError: Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. 1001 is neither. #1774
Comments
hey guys, any updates on it? |
Hey @wowafelyk thanks for opening this issue! As you can imagine this is hard to reproduce, but it is on our radar now. @followthemoney1 did you have the same error? Do you have any specific info that can help us reproduce it? |
@esarbanis yeah same error here, I don't have specific info but I cqn tell you app Id in get stream which we are using so you can track maybe |
This issue is stale because it has been open for 20 days with no activity. |
This issue was closed because it has been inactive for 7 days since being marked as stale. |
I'm experiencing this issue as well. Has this been looked at? It is pretty consistently happening on the web. |
We seem to be getting thousands of events due to this issue, which depletes our quota on Sentry. |
Same case |
I am also experiencing this issue. Invalid argument(s): Invalid argument: 1001, close code must be 1000 or in the range 3000-4999 utils.dart in checkCloseCode at line 10:5 within web_socket |
It appears because status.goingAway is used, which is 1001: Please see the docs here: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code so as soon as a user goes away, it throws the closure with 1001, in websocket.dart: if (_webSocketChannel != null) { From https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#code: If unspecified, a close code for the connection is automatically set: to 1000 for a normal closure, or otherwise to another standard value in the range 1001-1015 that indicates the actual reason the connection was closed. If specified, the value of this code parameter overrides the automatic setting of the close code for the connection, and instead sets a custom code. The value must be an integer: either 1000, or else a custom code of your choosing in the range 3000-4999. If you specify a code value, you should also specify a reason value. -- Reading that, you aren't supposed to specify status.goingAway explicitly, and just leave it unspecified? Not too familiar with this, just parsing it -- otherwise it seems if specified, a custom status (maybe 3001) for status.goingAway should be used instead. |
Experiencing the same here. Hopefully this get looked into |
The 1001 - Going Away status is typically reserved for server-side closures. If a client wants to gracefully close the connection and notify the backend of a specific reason, it’s better to use 1000 - Normal Closure or a 3000-3999 code, provided both teams maintain a record of what each code represents. |
still seeing this in stream_chat_flutter: ^8.3.0 / flutter 3.24. Is there update on this? will stream_chat_flutter: 9.2 / flutter 3.27/9 fix this issue? this happened on iPad / iOS for us. |
Which packages are you using?
stream_chat_flutter
On what platforms did you experience the issue?
Web
What version are you using?
stream_chat_flutter: ^6.10.0
What happened?
We receive multiple errors via sentry with next decription:
InvalidAccessError: Failed to execute 'close' on 'WebSocket': The code must be either 1000, or between 3000 and 4999. 1001 is neither
Application doesn't use WebSocket directly. Only possible dependency are via StreamChat.
Steps to reproduce
Steps ara mostly unknown except: All occurrences happen before login. It could be possible users where logged out with time out earlier.
Supporting info to reproduce
No response
Relevant log output
The text was updated successfully, but these errors were encountered: