Can I push to a browser? - WeOnlyDo Discussion board

Can I push to a browser? (wodWebServer / wodWebServer.NET)

by John Baker, Tuesday, December 07, 2004, 06:48 (7290 days ago)

I am embedding WODWEBSERVER in the control program of an industrial robot. The operator will use an industrial PDA running a browser. I would like to have the operator see status information about the robot on part of the pages I serve up - eg a fault in the robot would raise a red light and a message in a text box on the served-up page.

I can poll from the browser (using a timer or by having the operator press a button), but this seems clunky.

Is there a clean way of doing this?

John Baker

Re: Can I

by wodSupport, Tuesday, December 07, 2004, 12:52 (7290 days ago) @ John Baker

John,

I'm not sure if I got your question correctly, but you want sort of notification from the server for the client, right?

HTTP protocol has no option for something like this, but we had some customers that required this. Their idea was to send request from the client, but server does not reply until there's some information for the client. In theory, connection is open forever. If it gets closed for whatever reason, client just sends it again...

In order to implement this with wodWebServer, I suggest you take a look at 'chunked transfer' VB sample provided with wodWebServer. It was added recently, so if you don't see it, please download wodWebServer again.

So, idea is this: from within RequestDone event you should just describe response that will be sent back, but don't send any yet. You must use Chunked transfers because size of response is not known at the time.
Then, each time you want to send something to the client, use SendChunk method to send more data. In most cases, IE will immediately show it in user's window.

Perhaps that will help?

Re: Can I

by John Baker, Wednesday, December 08, 2004, 00:45 (7289 days ago) @ wodSupport

Your suggestion looks right to me.

I understand that the browser makes a request to which the server makes a response, chunked. The server can then continue to send chunk after chunk over an extended period of time. When the browser receives each chunk it implements the received HTML.

I downloaded wodWebServer.exe again but cannot find any references to chunk . It is not in the one project under ActiveX or in the seven projects under Component .

Where do I find it?


John Baker

Re: Can I

by wodSupport, Wednesday, December 08, 2004, 01:01 (7289 days ago) @ John Baker

Hmm, perhaps we didn't upload that sample. Just to make sure, I have just reuploaded wodWebServer installation, sample file is located in

Samples\VB\Component\8. Chunked response

can you download it again and install?

Re: Can I

by John Baker, Wednesday, December 08, 2004, 06:55 (7289 days ago) @ wodSupport

I am running the Chunked VB sample.

My browser does not progressively change. It doesn't change at all until the line 'user.Response.Send' is executed. I inserted a couple of dummy lines with breakpoints:

i=i <-- breakpoint - browser is unchanged
user.Response.Send
i=i <-- breakpoint - browser displays whole list

Do I have to set something in the browser to get it to progressively display as chunks are sent?

Is there a reason why notification is used in this sample?

John Baker

Re: Can I

by wodSupport, Wednesday, December 08, 2004, 13:31 (7289 days ago) @ John Baker

My browser does not progressively change. It doesn't change at all until the line 'user.Response.Send' is executed. I inserted a couple of dummy lines with breakpoints:

i=i <-- breakpoint - browser is unchanged
user.Response.Send
i=i <-- breakpoint - browser displays whole list

This also depends on content you're sending. Do you get same results with our sample, unchanged? Do you use IE or some other browser?

Do I have to set something in the browser to get it to progressively display as chunks are sent?

Not that I'm aware of, you cannot change browser's behavior.

Is there a reason why notification is used in this sample?

No particular reason, we just used fast notifications sample as template for new project.

Re: Can I

by John Baker, Wednesday, December 08, 2004, 20:16 (7289 days ago) @ wodSupport

I found the problem.

I am running McAfee. I turned off their Privacy Service and the example displays on my browser (IE6 by the way), progressively, as it should.

Thankyou for your help. I appreciate your responsiveness at answering my questions.


John Baker

Re: Can I

by wodSupport, Wednesday, December 08, 2004, 21:03 (7289 days ago) @ John Baker

John,

good news. I didn't know antivirus software can interfere with that. I'll try to remember it - perhaps someone else encounters same problem.

Regards.