     sendMessage: (message) ->
         @addMessage message
 
-        (@props.connection).send message
+        _.forEach @props.connections, (connection) ->
+            blob =
+                type: "message"
+                data: message
+            connection.send blob
 
 
 ChatDisconnected = React.createClass

    render: ->
        @state.currentComponent

    onConnect: ->
        @props.addAlert type: "warning",
            (Dom.span null,
                (Dom.strong null, "Well done! "),

        currentComponent: Noop()

    componentWillMount: ->
        @peer = new Peer key: PEER_KEY, debug: 2
        @connections = []

        otherPersonPeerId = getSegments()[1]

        @peer.on "open", (peerId) =>
            @peerId = peerId

            if not otherPersonPeerId?
                @setState currentComponent: ChatDisconnected(peerId: @peerId)

                @peer.on "connection", (connection) =>
                    connection.on "error", (error) ->
                        console.log error

                    @connections.push connection

                    connection.on "open", =>
                        _.forEach @connections, (connection) =>
                            blob =
                                type: "connections"
                                data: _.map @connections, (connection) -> connection.peer
                            connection.send blob

                        @setState currentComponent: ChatConnected(peerId: @peerId, connections: @connections)
            else
                connection = @peer.connect otherPersonPeerId
                connection.on "error", (error) ->
                    console.log error

                @connections.push connection

                window.original_connection = connection

                connection.on "open", =>

                    connection.on "data", (blob) =>
                        if blob.type == "connections"
                            console.log @peerId
                            peerIds = blob.data
                            console.log peerIds
                            peerIds = _.filter peerIds, (peerId) => peerId != @peerId
                            console.log peerIds

                            _.forEach peerIds, (peerId) =>
                                connection = @peer.connect peerId
                                connection.on "error", (error) ->
                                    console.log error

                                @connections.push connection

                            @setState currentComponent: ChatConnected(peerId: @peerId, connections: @connections)

    componentDidMount: ->
        # TODO: This should be in `componentWillMount`.
