Sending binary data

Nov 19, 2012 at 7:40 PM

I was considering using signalR for an application in which I need to send data from the cell phone to the cloud every second or so.  I can pack the data several minutes and send it also, as the requirements do not need to be real time.

1)  Can superwebsocket let me send binary data as it is that i can interpret on the cloud ?

2) sending smaller packets every sec Vs sending large packets every few minutes ? Which approach is better considering reliability of the network and battery life of the cellular device.

3) if I have to make my application scalable, monitoring data from thousands of cellular data how can i use superwebsocket along with Azure?

Any help is greatly appreciated.

 

 

 

 

Nov 20, 2012 at 1:27 AM

1) Of course yes, because the websocket protocol (rfc6455) defines the binary data frame. SuperWebSocket is a standard websocket server and it also supprots binary frame.

2) I think sending large packets every few minutes is better, because you can compress the large packets smaller. And the connected socket is not required then, because you can open a connection only when you want to send data.

3) Yes, there is a sample to guide you how to run SuperWebSocket in Windows Azure. BTW, you should make your SuperWebSocket stateless, then you can scale out your server correctly.

Nov 20, 2012 at 4:08 AM

 

Thanks a lot. Very useful information. Sorry I am new here and there is so many things available on the net not sure which is the right thing for my problem :)

1) Can superwebsocket be used for some what real time system ? 1 message / sec.

2) What is the maximum binary data i can send in a message ?

3)  I looked at the cloud sample and it simply has a worker role.  I guess the idea is to load the worker load until it cant handle anymore clients, and keep on increasing the number of worker roles ?  All the clients in a worker role share the same connection ? Do I have to still use Azure Service Bus / WCF in webrole ?

 

Thanks in advance.

 

 

Nov 20, 2012 at 4:15 AM

1) Of course, yes.

2) Nearly unlimited, but for better performance and fault-tolerant, please don't send too large data in one message

3) This question is about Windows Azure. You should create more instances for this role in Windows Azure Management Portal to handle more connections. One client means one websocket connection(TCP). Mention it again: you should make your code stateless. It is same with other distributed applications, please google it for more informations. It's not business of SuperWebSocket.

Nov 20, 2012 at 4:47 AM
Edited Nov 20, 2012 at 5:02 AM

Thanks a bunch. When you say stateless I cant have a dedicated websocket/connection between a cleint and the server correct ? SuperWebsocket are meant for persistent connection though right ? Do you have an example on SuperWebsocket stateless ?

Or I simply close the socket after I am done processing the message ?

Jun 28, 2013 at 9:21 AM
Hi,

I am trying to send and received binary buffer data But unfortunately i found "socketServer_SessionClosed" event at global.asax file has been fired and its through "CloseReason" is protocalError.

So please can you guide me regarding this.

--At Javascript, My code for sending binary data is

        contexto.drawImage(canvas, 0, 0);
        var image = contexto.getImageData(0, 0, 400, 300);
        var binary_data = new Uint8Array(image.data.length);
        for (var i = 0; i < image.data.length; i++) {
            binary_data[i] = image.data[i];
        }

ws.send(binary_data.buffer,1,1);

Thank you in advance.
Jun 28, 2013 at 3:42 PM
Did you check the error log? It may be caused by maxRequestLenght limitation.

http://docs.supersocket.net/v1-5/Logging-in-SuperSocket
http://docs.supersocket.net/v1-5/SuperSocket-Basic-Configuration
Jul 1, 2013 at 8:15 AM
Edited Jul 1, 2013 at 8:17 AM
I checked error log file and i found below error:

"ERROR SuperWebSocket - Listener (0.0.0.0:8080) error: Only one usage of each socket address (protocol/network address/port) is normally permitted"

Also i have changed "MaxRequestLength" (value: 100000000) at Setup() method at two class files.

However my issue has not been resolve yet. Can you please me regarding.
Jul 1, 2013 at 8:21 AM
Yes, I think your problem is "maxRequestLength", please adjust it in the configuration file.
Jul 1, 2013 at 2:03 PM
I have tried to add "maxRequestLength" in configuration files too.

<appSettings>
<add key="ServiceName" value="SuperWebSocket"/>
<add key="maxRequestLength" value="100000000"/>
</appSettings>

However i am not getting any success.

Actually, I am creating designer dashboard using canvas HTML5 control, This designer dashboard should be get interactive or use bidirectional communication with websocket.

I tried to create demo web application using superwebsocket project and where string message have sent and received by websockets, Now i customize this code and trying to send received binary data (byte[]) but still could not getting proper success.

If you have any sample code where this kind of scenario use then please send link to me.

Thanks
Jul 1, 2013 at 3:05 PM
Oh, completely wrong. Did you read the doc I mentioned?

Sent from my Windows Phone

From: vijayant
Sent: 7/1/2013 21:04
To: [email removed]
Subject: Re: Sending binary data [SuperWebSocket:403842]

From: vijayant

I have tried to add "maxRequestLength" in configuration files too.

<appSettings>
<add key="ServiceName" value="SuperWebSocket"/>
<add key="maxRequestLength" value="100000000"/>
</appSettings>

However i am not getting any success.

Actually, I am creating designer dashboard using canvas HTML5 control, This designer dashboard should be get interactive or use bidirectional communication with websocket.

I tried to create demo web application using superwebsocket project and where string message have sent and received by websockets, Now i customize this code and trying to send received binary data (byte[]) but still could not getting proper success.

If you have any sample code where this kind of scenario use then please send link to me.

Thanks