thank you :), I will test and see if it works.


2014-08-31 6:11 GMT-03:00 Shashi Gowda <shashigowd...@gmail.com>:

> Hey, it looks like WebSockets.jl wasn't setting the right flags in
> WebSocket packets for binary data. This patch makes your code work
> https://github.com/JuliaWeb/WebSockets.jl/pull/16 :)
>
>
> On Mon, Aug 25, 2014 at 6:53 PM, Altieres Del-Sent <
> altieresdels...@gmail.com> wrote:
>
>> HI,
>>
>> I am testing the websocket because I want to use it to send e receive
>> binary data. So far the sending from browser to client has worked but the
>> sending from the server to the client ( more important) it's not, it gives
>> me the message. I will probably will switch to a base64, but anyone has
>> anyidea how to solve that?
>>
>> ERROR: read: end of file
>>
>>  in read at iobuffer.jl:68
>>
>>  in read at stream.jl:641
>>
>>  in write at stream.jl:749
>>
>>  in read_frame at C:\Users\altieres\.julia\WebSockets\src\WebSockets.jl:189
>>
>>
>> I have the follow code in the server
>>
>> using HttpServer
>>
>> using WebSockets
>>
>>
>> wsh = WebSocketHandler() do req,client
>>
>>         while true
>>
>>             msg = read(client)
>>
>>             floatArray = reinterpret(Float64,msg)
>>
>>
>>             for t in floatArray
>>
>>                 print(t)
>>
>>                 print("\n")
>>
>>             end
>>
>>             write(client, reinterpret(Uint8,[1.0,2.0,3.0]))
>>
>>         end
>>
>>       end
>>
>>
>> server = Server(wsh)
>>
>> run(server,8090)
>>
>> and the follow in the cliente...
>>
>> <html>
>>     <head>
>>
>>
>>         <title>TODO supply a title</title>
>>         <meta charset="UTF-8">
>>         <meta name="viewport" content="width=device-width, 
>> initial-scale=1.0">
>>         <script>
>>
>>
>>             var ws = new WebSocket("ws://localhost:8090");
>>             ws.onmessage = function(msg) {
>>                 var result = new Float64Array(msg.data);
>>                 var str = "";
>>
>>
>>                 for(var i = 0; i < result.length;i++) {
>>                     str += result[i];
>>                 }
>>                 document.getElementById("log").textContent = str;
>>             };
>>
>>
>>
>>             ws.onopen = function (event) {
>>                 var array = new Float64Array(300);
>>                 for(var i = 0; i < 300; i++) {
>>                     array[i] = i;
>>                 }
>>
>>
>>                 ws.send(array);
>>             };
>>
>>
>>         </script>
>>
>>     </head>
>>     <body>
>>         <div id="log">TODO write content</div>
>>
>>
>>     </body>
>> </html>
>>
>>
>>
>>
>

Reply via email to