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

Client throws error when buffer is received #330

Closed
MenuItem207 opened this issue Apr 22, 2023 · 3 comments
Closed

Client throws error when buffer is received #330

MenuItem207 opened this issue Apr 22, 2023 · 3 comments
Labels

Comments

@MenuItem207
Copy link

Calling socket.emitWithAck throws the error: Error: Expected a value of type 'List', but got one of type 'NativeByteBuffer'. This error occurs when my Socket.IO server acknowledges the event with data that contains a <Buffer 00> object (NodeJS).
The callstack:

Error: Expected a value of type 'List<int>', but got one of type 'NativeByteBuffer'
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49      throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 99:3        castError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 485:10  cast
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/classes.dart 638:14     as_C
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/internal/cast.dart 99:46                                             _get
packages/socket_io_common/src/parser/binary.dart 67:58                                                                         _reconstructPacket
packages/socket_io_common/src/parser/binary.dart 70:22                                                                         <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart 249:8              forEach
packages/socket_io_common/src/parser/binary.dart 69:11                                                                         _reconstructPacket
packages/socket_io_common/src/parser/binary.dart 59:22                                                                         <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 201:8                 forEach]
packages/socket_io_common/src/parser/binary.dart 58:12                                                                         _reconstructPacket
packages/socket_io_common/src/parser/binary.dart 70:22                                                                         <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/convert_patch.dart 249:8              forEach
packages/socket_io_common/src/parser/binary.dart 69:11                                                                         _reconstructPacket
packages/socket_io_common/src/parser/binary.dart 59:22                                                                         <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 201:8                 forEach]
packages/socket_io_common/src/parser/binary.dart 58:12                                                                         _reconstructPacket
packages/socket_io_common/src/parser/binary.dart 49:22                                                                         reconstructPacket
packages/socket_io_common/src/parser/parser.dart 321:27                                                                        takeBinaryData
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 431:10  callMethod
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 435:5   dsend
packages/socket_io_common/src/parser/parser.dart 168:37                                                                        add
packages/socket_io_client/src/manager.dart 244:13                                                                              ondata
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
packages/socket_io_common/src/util/event_emitter.dart 61:14                                                                    <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 201:8                 forEach]
packages/socket_io_common/src/util/event_emitter.dart 60:11                                                                    emit
packages/socket_io_client/src/engine/socket.dart 463:11                                                                        onPacket
packages/socket_io_client/src/engine/socket.dart 287:34                                                                        <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
packages/socket_io_common/src/util/event_emitter.dart 61:14                                                                    <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/js_array.dart 201:8                 forEach]
packages/socket_io_common/src/util/event_emitter.dart 60:11                                                                    emit
packages/socket_io_client/src/engine/transport/transport.dart 127:5                                                            onPacket
packages/socket_io_client/src/engine/transport/transport.dart 121:5                                                            onData
packages/socket_io_client/src/engine/transport/websocket_transport.dart 59:48                                                  <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37  _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39  dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37340:58                              <fn>

The following line is where the error is thrown (_reconstructPacket in the class: Binary):

return num >= 0 && num < buffers.length ? buffers[num] : null;
@jumperchen
Copy link
Member

Which version on NodeJS are you using?
Do you have any reproduced example for us to test?

@jumperchen jumperchen added the bug label Apr 24, 2023
@MenuItem207
Copy link
Author

Version 19, I don't think its related to the version though. Here's an example project for flutter web + nodejs

@jumperchen
Copy link
Member

Thanks for the info., I meant to the version of socket.io on NodeJS. Anyway, I will try to identify this issue.

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

No branches or pull requests

2 participants