             senderId = messageObj.senderId
             if "*:*" is senderId
                 for own _, conn of @txconn
-                    conn.send messageObj.data
+                    try
+                        conn.send messageObj.data
+                    catch e
+                        Log.e 'broadcast exception: ', e
             else
                 txconn = @txconn[senderId]
                 if txconn
-                    txconn.send messageObj.data
+                    try
+                        txconn.send messageObj.data
+                    catch e
+                        Log.e 'send exception: ', e
                 else
                     @_respReceiverError 'Invalid sender id'
 

                @txconn[senderId].close()
            @txconn[senderId] = senderConn

            @rxconn.send JSON.stringify
                type: 'senderConnected'
                senderId: senderId

            senderConn.on 'message', (message) =>
                Log.i "Receive from sender ", message;
                @rxconn?.send JSON.stringify
                    type: 'message'
                    senderId: senderId
                    data: message

            senderConn.on 'close', =>
                @rxconn?.send JSON.stringify
                    type: 'senderDisconnected'
                    senderId: senderId
                @_removeSenderConn senderId
        else
            senderConn.close()

        delete @txconn[senderId]

    _respReceiverError: (message) ->
        try
            @rxconn.send JSON.stringify
                type: 'error'
                message: message
        catch e
            Log.e e

class WebSocketServer

