GauravBasu / jquery-stream

Automatically exported from code.google.com/p/jquery-stream
0 stars 0 forks source link

Improvment: better exception handling when stream is closed #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. (try) open the stream.
2. (try) close the stream(.close or .handleClose(...))
3. .send() some data.

What is the expected output? What do you see instead?
this.dataQueue is "undefined". you check "if (this.readyState === 0)" but you 
set the readyState to 3 on disconnection. You should implement an readyState=3 
check and throw an $.error "stream is closed".

What version of the product are you using? On what operating system?
1.2

Please provide any additional information below.
an "undefined.push" - excpetion, if you don't check this, is not the better 
solution ;)

Original issue reported on code.google.com by sebastia...@gmail.com on 23 Jul 2011 at 12:07

GoogleCodeExporter commented 9 years ago
Sorry, i ment version 1.1, but maybe this problem exists in futur 1.2, too.

Original comment by sebastia...@gmail.com on 24 Jul 2011 at 10:56

GoogleCodeExporter commented 9 years ago
An undefined error is fixed by chance in revision 123.

I agree with your idea about throwing exception, but that is a deliberate 
behavior based on the WebSocket spec. Even though the spec has nothing to do 
with http streaming, as the Stream API is based on the WebSocket API, the 
dataQueue is intended to increase like the bufferedAmount attribute of the 
WebSocket when the send method is called after a stream is closed.

As the current spec, of course, is draft, it can change in the future.

Donghwan

Original comment by flowersi...@gmail.com on 31 Jul 2011 at 3:00