Showing results for 
Search instead for 
Did you mean: 

Streaming WebService and checking when connection ends

I am using a web service set to stream.  It's being used to stream Server Sent Events (SSE) to a website.  Everything works as expected except when the connection ends the VI seems to keep running streaming to no one which also blocks the next connection to the web service from starting the VI and getting the stream.  Is there a way to know when a connection has disconnected inside the VI that is streaming?


I've tried just stopping the connection after a set time and make the web client reconnect; however, that introduces a delay in viewing the data when the user is still connected and isn't ideal.


I've also made the web client "poke" a separate web service which saves a time stamp to a global variable that the streaming web service uses to know if the client is still there.  This works but requires a lot of extra stuff going on that is a bit of a pain to code and manage for each streaming service.


Ideally, the streaming VI would have a way to know if the client is still listening to that connection.  Any ideas?  Alternatively, is there a way to make it so multiple connections can be running the same VI at the same time?  By default, I find that a running web service on a VI blocks requests for the same VI.   Right now my system only allows one user to be logged in so this isn't an issue.

0 Kudos
Message 1 of 2

Hi GreenRiver,


If your VI is stateless, you might want to check the Reentrancy settings. That might solve your "many callers for one VI" issue.


With regards to your VI running indefinitely, could you consider having the receiver acknowledge receipt? Or perhaps sending a watchdog-like kick (this sounds a lot like what you already described with your poking though, so maybe that's already too much extra trouble).

Can you provide an example (simplified, with fake data perhaps) of your streaming VI so we could look over it?

0 Kudos
Message 2 of 2