icomet icon indicating copy to clipboard operation
icomet copied to clipboard

Closing connection?

Open Elite opened this issue 11 years ago • 4 comments

Can I close connection from JavaScript ?

Elite avatar Feb 03 '14 12:02 Elite

Yes, call comet.stop()/iComet.stop().

ideawu avatar Feb 04 '14 00:02 ideawu

Thanks, I am using the code below but the connection remains alive. Am I missing something here -

<script  type="text/javascript">
            var comet = new iComet({
                channel: '52ecade096a367b59dcb8cbd581f2ae53a4f8a8763b9d',
                subUrl: 'http://myurl/comet/sub',
                callback: function(content){
                    // on server push
                    console.log(content);
                    if (content.indexOf("completed") >= 0)
                    {
                        console.log('the End');
                        comet.stop();
                    }
                }
            });
        </script>

Elite avatar Feb 04 '14 13:02 Elite

Hi, the connection could not be closed instantly, wait for ``channel_timeout` seconds, the connection will be closed.

ideawu avatar Feb 05 '14 11:02 ideawu

But the timeout is not working, see the attached screenshot. sshot-1

Elite avatar Feb 05 '14 13:02 Elite