better websocket error handling

This commit is contained in:
Yessiest 2024-07-07 21:28:51 +04:00
parent a15e531fdc
commit 20c312d9a9
1 changed files with 8 additions and 0 deletions

View File

@ -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