At first, I would think if you say "mistake", you really mean "warning". They are really two different things, and the browser treats them differently (usually it only tracks / warns warnings when the developer tools are open, etc.).
So, first, I would question the assumption that this is even a problem (the overhead of the browser is "automatic typing" of blob compared to the overhead of the "newbie" on Blob, etc.).
But, nevertheless, the blob.type property is really useless in JavaScript, and so you should set it when blob is "newed". In your case, it sounds like you are receiving data from an Objective-C socket and simply connecting it with:
ws.send(fromObjectiveCSocket, {binary: true, mask: true});
The native blob data from the Objective-C socket does not contain data of the type "header" type when it sends it, and it looks like your node does not touch blob at all (did you try decorating the new Blob in your node and then sending it over the socket, to see if it saves text?).
So what happens is that websocket only sends blob data as it is received, and when the receiving javascript receives it, it implicitly enters it with a new Blob right then and there, just with an empty type.
So essentially no, there seems to be no way around the new Blob construct if you really want to get rid of this warning. Even if you tried tricks, such as adding a type to blob data and then splicing them, etc., you still cannot get around the websocket receive code by implicitly typing it as a blob with an empty type.
Nick sharp
source share