def on_close(code, reason)
      debug "Server closed connection with code #{code}: #{reason}"

      case code
      when 4001
        handle_invalid_token
      when 4010
        handle_invalid_version(reason)
      when 4040, 4041
        handle_invalid_connection(reason)
      else
        warn "connection closed with code #{code}: #{reason}"
      end
    end
def on_close(code, reason)
      debug "Server closed connection with code #{code}: #{reason}"

      case code
      when 4001
        handle_invalid_token
      when 4010
        handle_invalid_version(reason)
      when 4040, 4041
        handle_invalid_connection(reason)
      else
        warn "connection closed with code #{code}: #{reason}"
      end
    end
Server closed websocket connection

 @param code [Integer]
 @param reason [String]