         unless result?
             result = @_parseStreamIOMessage message
 
-        if result?
-            callback result
-
-
-    _isValidMessage: (message) ->
-        unless message?
-            console.log "Invalid message: null"
-            return false
-
-        unless message.content?
-            console.log "Invalid message: Missing content"
-            return false
-
-        if message.content.execution_state is 'starting'
-            # Kernels send a starting status message with an empty parent_header
-            console.log "Dropped starting status IO message"
-            return false
-
-        unless message.parent_header?
-            console.log "Invalid message: Missing parent_header"
-            return false
-
-        unless message.parent_header.msg_id?
-            console.log "Invalid message: Missing parent_header.msg_id"
-            return false
-
-        unless message.parent_header.msg_type?
-            console.log "Invalid message: Missing parent_header.msg_type"
-            return false
-
-        unless message.header?
-            console.log "Invalid message: Missing header"
-            return false
-
-        unless message.header.msg_id?
-            console.log "Invalid message: Missing header.msg_id"
-            return false
-
-        unless message.header.msg_type?
-            console.log "Invalid message: Missing header.msg_type"
-            return false
-
-        return true
+        return result
 
 
     _parseDisplayIOMessage: (message) ->



    _parseDataMime: (data) ->
        if data?
            imageMimes = Object.getOwnPropertyNames(data).filter (mime) ->
                return mime.startsWith 'image/'

            if data.hasOwnProperty 'text/html'
                mime = 'text/html'

            else if data.hasOwnProperty 'image/svg+xml'
                mime = 'image/svg+xml'

            else if not (imageMimes.length is 0)
                mime = imageMimes[0]

            else if data.hasOwnProperty 'text/markdown'
                mime = 'text/markdown'
            else if data.hasOwnProperty 'application/pdf'
                mime = 'application/pdf'

            else if data.hasOwnProperty 'text/latex'
                mime = 'text/latex'

            else if data.hasOwnProperty 'text/plain'
                mime = 'text/plain'

        if mime is 'text/plain'
            result =



    destroy: ->
        console.log 'sending shutdown'

        requestId = uuid.v4()

        header =
                msg_id: requestId,
                username: '',
                session: 0,
                msg_type: 'shutdown_request',
                version: '5.0'

        content =
                restart: false
