better websocket error handling
This commit is contained in:
parent
a15e531fdc
commit
20c312d9a9
|
@ -125,6 +125,10 @@ module Landline
|
|||
type: type
|
||||
)
|
||||
@io.write(frame.to_s)
|
||||
rescue Errno::EPIPE => e
|
||||
@writable = false
|
||||
_emit :error, e
|
||||
close
|
||||
end
|
||||
|
||||
# Read data from socket synchronously
|
||||
|
@ -219,6 +223,10 @@ module Landline
|
|||
frame = @frame_parser.next
|
||||
return frame if frame
|
||||
end
|
||||
rescue Errno::ECONNRESET => e
|
||||
@writable = false
|
||||
_emit :error, e
|
||||
close
|
||||
end
|
||||
|
||||
# Close the websocket
|
||||
|
|
Loading…
Reference in New Issue