code: def _handle_msg(self, msg):
          
          data = msg['content']['data']
          method = data['method']
  
          if method == 'update':
              if 'state' in data:
                  state = data['state']
                  if 'buffer_paths' in data:
                      _put_buffers(state, data['buffer_paths'], msg['buffers'])
                  self.set_state(state)
  
          # Handle a state request.
          elif method == 'request_state':
              self.send_state()
  
          # Handle a custom msg from the front-end.
          elif method == 'custom':
              if 'content' in data:
                  self._handle_custom_msg(data['content'], msg['buffers'])
  
          # Catch remainder.
          else:
              self.log.error('Unknown front-end to back-end widget msg with method "%s"' % method)
docs: Called when a msg is received from the front-end