max-mapper / websocket-stream

websockets with the node stream API
BSD 2-Clause "Simplified" License
668 stars 114 forks source link

Add support for passing options to ws.send() #94

Closed laszbalo closed 8 years ago

laszbalo commented 8 years ago

Hi,

I came across a situation, #https://github.com/mcollina/aedes/issues/61, when it was necessary to force the underlying node websocket to send all the data in binary data frames. With the change I made, someone can pass the following extra arguments to websocket-stream as options: binary, mask, fin, compress. These arguments then will be passed to ws.send() on every invocation.

mcollina commented 8 years ago

Thanks

mcollina commented 8 years ago

LGTM for me @maxogden @mafintosh?

mafintosh commented 8 years ago

why does it have to make a new options map on every call? can it not reuse it?

mcollina commented 8 years ago

@mafintosh it seems options gets overwritten internally by ws.

mcollina commented 8 years ago

@laszlabo are you sure this does not work by always passing in the same object? I'm wondering what problems can achieve that, the options stays the same. Sorry for being picky here, that bit seems so wrong :/.

Introvertuous commented 8 years ago

I ran into this issue recently as well, has it not yet been resolved?

mcollina commented 8 years ago

It has been around for quite a while, I'm merging and releasing as minor.