Skip to content

Original data mutated during encoding? #95

Closed
@dominic-p

Description

@dominic-p

Apologies if this is the wrong repo for this.

I have noticed that when I pass binary data to socket.io's emit function, that data is transformed in place. For example, File objects become ArrayBuffer objects. It makes sense why this needs to happen, but would it be possible to generate a modified copy of the data for transmission instead of mutating it in place?

As it is now, I find myself defensively deep cloning anything I pass to socket.io which is actually kind of hard to do well (JSON encoding and parsing leads to bugs, structured clone would be great but isn't exposed by browsers, circular references create issues, etc).

Thanks for the great software, btw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions