Stream Binary data to javascript html from Java ServerSocket -


i trying stream binary data, html page using java server built using serversocket. able achieve using xmlhttprequest, observing big delay in receiving end. please share better way same avoid delay. built websocket server using java not able receive data binary in javascript.

i assume didn't specify content length of binary stream and/or not close servlet output stream. please consider following code

    protected void doget(httpservletrequest request,httpservletresponse response)  throws servletexception, ioexception {        byte[] binarydata = createbinarycontent();        outputstream out = response.getoutputstream();        response.setcontenttype("application/octet-stream");        response.setcontentlength(binarydata.length);        out.write(binarydata);        out.close();     }   

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -