code: function onMessage(message) {
      if (message.type != "utf8") return
  
      DEBUGMSG("recv: " + message.utf8Data)
      message = JSON.parse(message.utf8Data)
  
      if      (message.type == "request")  session.onRequest(channel, message)
      else if (message.type == "response") session.onResponse(channel, message)
      else if (message.type == "event")    session.onEvent(channel, message)
    }
docs: -----------------------------------