ForceUniverse / dart-force

Dart Realtime Web Framework!
https://pub.dartlang.org/packages/force
Other
89 stars 9 forks source link

Sending Files #28

Closed derrick56007 closed 9 years ago

derrick56007 commented 9 years ago

Hi, I was just wondering if it was possible to send file/data other than strings through the use of forceServer.send(). If possible, would you be able to typecast the object once it reached the client? I figured once it is serialized you would have to do a conversion afterwards.

jorishermans commented 9 years ago

What you send doesn't matter. It is not a string, it is a dynamic type. When force is sending it through the wire he encodes it with json and at the other end he decodes it.

Take a look at https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/dart:io.File#id_openRead With openRead you can access a List so you can send the bytes of the file. At the client you can then construct it again by reading the list of ints.

Using his bytes and sending the bytes of the file would be the ideal solution for this.

derrick56007 commented 9 years ago

Thanks for the clearing that up! Keep up the good work.