lib/websocket/eventmachine/base.rb in websocket-eventmachine-base-1.0.2 vs lib/websocket/eventmachine/base.rb in websocket-eventmachine-base-1.0.3

- old
+ new

@@ -184,10 +184,19 @@ end else break end end - unbind if @frame.error? + handle_error(@frame.error) if @frame.error? + end + + def handle_error(error) + error_code = case error + when :invalid_payload_encoding then 1007 + else 1002 + end + close(error_code) + unbind end def handle_closing(data) unless @state == :closed @state = :closed