def on_session_ended
      url = @connection.url
      room = @room
      @connection = nil
      @room = nil

      # Automatically reconnect to the room / server if allowed
      if @reconnect
        reconnect_from(Exception) do
          room ? room.enter : connect(url)
          trigger(:reconnected)
        end
      end
    end
def on_session_ended
      url = @connection.url
      room = @room
      @connection = nil
      @room = nil

      # Automatically reconnect to the room / server if allowed
      if @reconnect
        reconnect_from(Exception) do
          room ? room.enter : connect(url)
          trigger(:reconnected)
        end
      end
    end
Callback when the session has ended.  This will automatically reconnect if
 allowed to do so.