pubnub / javascript

PubNub JavaScript SDK docs https://www.pubnub.com/docs/sdks/javascript
Other
553 stars 403 forks source link

Allow to send data as ArrayBuffer and Blob #25

Closed piranna closed 10 years ago

piranna commented 10 years ago

Currently PubNub allow to send data in the basic types (number, string, object, text...). I propose to allow to send it as ArrayBuffer and Blob, so it can be send also on binary form, for example using MessagePack, so data don't get lenght increased.

stephenlb commented 10 years ago

hey, that is a good idea~!

piranna commented 10 years ago

I'm happy you liked it! :-)

geremyCohen commented 10 years ago

We're also experimenting with sending via POST. How would that fit into things @piranna ?

piranna commented 10 years ago

We're also experimenting with sending via POST. How would that fit into things @piranna https://github.com/piranna ?

I propose it some weeks ago. Being able to send binary data via ArrayBuffer, BLOBs, POST requests or WebSockets is totally fine for me :-)

"Si quieres viajar alrededor del mundo y ser invitado a hablar en un monton de sitios diferentes, simplemente escribe un sistema operativo Unix." – Linus Tordvals, creador del sistema operativo Linux

parasyte commented 10 years ago

So long as there is a method of serializing and deserializing these data types, go for it! The only supported serializer at the moment is JSON.

On Fri, Jan 17, 2014 at 10:29 AM, Jesús Leganés Combarro < notifications@github.com> wrote:

We're also experimenting with sending via POST. How would that fit into things @piranna https://github.com/piranna ?

I propose it some weeks ago. Being able to send binary data via ArrayBuffer, BLOBs, POST requests or WebSockets is totally fine for me :-)

"Si quieres viajar alrededor del mundo y ser invitado a hablar en un monton de sitios diferentes, simplemente escribe un sistema operativo Unix." – Linus Tordvals, creador del sistema operativo Linux

— Reply to this email directly or view it on GitHubhttps://github.com/pubnub/javascript/issues/25#issuecomment-32631800 .

piranna commented 10 years ago

According to https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Sending_typed_arrays_as_binary_data, It's possible to send ArrayBuffers via POST using XmlHttpRequest. This would allow to use MessagePack or any other binary serialization, although maybe it would require to allow to send raw messages instead of allowing PubNub library to autoatically serialize them using JSON, maybe with a flag on the constructor or the publish method.

stephenlb commented 10 years ago

We are adding this soon! In fact it is currently under development.

On Thu, Jan 23, 2014 at 5:36 AM, Jesús Leganés Combarro < notifications@github.com> wrote:

According to https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Sending_typed_arrays_as_binary_data, It's possible to send ArrayBuffers via POST using XmlHttpRequest. This would allow to use MessagePack http://msgpack.org/ or any other binary serialization, although maybe it would require to allow to send raw messages instead of allowing PubNub library to autoatically serialize them using JSON, maybe with a flag on the constructor or the publish method.

— Reply to this email directly or view it on GitHubhttps://github.com/pubnub/javascript/issues/25#issuecomment-33123837 .

Cheers! Stephen Blum - CTO http://twitter.com/PubNub https://github.com/pubnub/pubnub-api - GitHub https://help.pubnub.com/ - Help Desk www.pubnub.com +1-425-830-6711

piranna commented 10 years ago

Cool! Thanks to have us informed! :-)

Send from my Samsung Galaxy Note II El 23/01/2014 21:19, "Stephen L. Blum" notifications@github.com escribió:

We are adding this soon! In fact it is currently under development.

On Thu, Jan 23, 2014 at 5:36 AM, Jesús Leganés Combarro < notifications@github.com> wrote:

According to

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Sending_typed_arrays_as_binary_data,

It's possible to send ArrayBuffers via POST using XmlHttpRequest. This would allow to use MessagePack http://msgpack.org/ or any other binary serialization, although maybe it would require to allow to send raw messages instead of allowing PubNub library to autoatically serialize them using JSON, maybe with a flag on the constructor or the publish method.

Reply to this email directly or view it on GitHub< https://github.com/pubnub/javascript/issues/25#issuecomment-33123837> .

Cheers! Stephen Blum - CTO http://twitter.com/PubNub https://github.com/pubnub/pubnub-api - GitHub https://help.pubnub.com/ - Help Desk www.pubnub.com +1-425-830-6711

Reply to this email directly or view it on GitHubhttps://github.com/pubnub/javascript/issues/25#issuecomment-33164035 .