 
                 peer.on "connection", (connection) =>
                     connection.on "open", =>
-                        @showAlertAboutNewConnection()
-
                         @connections.push connection
                         @listenForMessage connection
+
+                        @showAlertAboutNewConnection()
 
     render: ->
         (Dom.div null,

                @setState peerIdForHost: peerIdForHost

                peer.on "connection", (connection) =>
                    @connections.push connection
                    @listenForMessage connection

                    connection.on "open", =>
                        @showAlertAboutNewConnection()

                        connectionsWithoutNewConnection = _.filter @connections, (c) -> c.peer != connection.peer
                        peerIdsWithoutNewConnection = @connectionsToPeerIds connectionsWithoutNewConnection

                        if peerIdsWithoutNewConnection.length
                            connection.send type: "newConnection", peerIds: peerIdsWithoutNewConnection

            if not isHost
                @setState peerIdForHost: peerIdForHost

        peerIdForHost: null
        messages: []

    componentWillMount: ->
        peerIdForHost = getSegments()[1]
        isHost = not peerIdForHost?
