felangel / web_socket_client

A simple WebSocket client for Dart which includes automatic reconnection logic.
https://pub.dev/packages/web_socket_client
MIT License
150 stars 32 forks source link

feat: add `binaryType` parameter to WebSocket class #15

Closed mytja closed 1 year ago

mytja commented 1 year ago

Status

DONE

Description

Greetings, I really like this project. It's just so simple to use and painless. That's why I'm thanking you for your time taken to maintain the project. Unfortunately it wasn't working on Flutter for the Web, as I was using Protobuf and consequently ran into issues with JavaScript Blob to List (bytearray) conversion. This fix adds another parameter to the class, which is ran by the dart:html WebSocket class and with the help of it, I'm able to set the binaryType to arraybuffer, per this source and it successfully works with Protobuf.

Before adding the flag/parameter image

After adding the flag and setting it to arraybuffer image

Type of Change

felangel commented 1 year ago

@mytja thanks so much for the positive feedback and for contributing! Looks like ci is failing due to an analysis warning. Are you able to quickly resolve that? If not let me know and Iโ€™m happy to help ๐Ÿ‘

mytja commented 1 year ago

Sure, I can do that.

mytja commented 1 year ago

This should pass the analysis.