Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Trusted Contributor
Posts: 105
Registered: ‎02-02-2011
My Device: Bold 9900
My Carrier: Airtel

read data from server as streams in HTML5

In our java application we receive data from server as streams using following code

 

InputStream  is = httpConnection.openInputStream();

ByteArrayOutputStream baum = new ByteArrayOutputStream();

int available = input.available();

if (available < 1) {
available = 1024;
}

byte[] bytes = new byte[available];

int readBytes;
while ((readBytes = input.read(bytes)) > 0) {
baum.write(bytes, 0, readBytes);

}

byte[] byteData = baum.toByteArray();

if (byteData.length > 0) {

data = new String(byteData);
}

 

How we implement the same using HTML5 ?

Highlighted
Developer
Posts: 817
Registered: ‎11-19-2009
My Device: Z10, Q10, 9900, 9790, PlayBook,
My Carrier: T-Mobile UK, Three, O2, Orange, Sunrise, Swisscom

Re: read data from server as streams in HTML5

You should try to use WebSockets and if that doesn't work, you could lobby for RIM to include node.js in WebWorks.

--
Olivier - interfaSys ltd
Developing for BlackBerry 10 devices using the Sencha Touch framework.