                 @setState peerIdForHost: peerIdForHost
 
                 peer.on "connection", (connection) =>
-                    @connections.push connection
-                    @listenForMessage connection
-
                     connection.on "open", =>
+                        if @connections.length
+                            peerIds = _.map @connections, (connection) -> connection.peer
+                            connection.send type: "newConnection", peerIds: peerIds
+
+                        @connections.push connection
+                        @listenForMessage connection
+
                         @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: []

    connectionsToPeerIds: (connections) ->
        _.map connections, (connection) -> connection.peer

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


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

                        @showAlertAboutNewConnection()

    render: ->
        (Dom.div null,
