(self, data)
Default handler for sending messages as subprotocol.
Default handler for sending messages as subprotocol.
Default handler for sending messages as subprotocol .
def _send_protocol(self, data):
        """ Default handler for sending messages as subprotocol. """
        if _DEBUG:
            self.logger.info("Sending {}".format(data))

        if not self.client:
            raise error.ConnectionError("Not connected to Chromecast")

        try:
            self.client.send(json.dumps([self.protocol, data]).encode("utf8"))

        except socket.error:
            # if an error occured sending data over the socket
            raise error.ConnectionError("Error communicating with Chromecast")
def _send_protocol ( self , data ) : if _DEBUG : self . logger . info ( "Sending {}" . format ( data ) ) if not self . client : raise error . ConnectionError ( "Not connected to Chromecast" ) try : self . client . send ( json . dumps ( [ self . protocol , data ] ) . encode ( "utf8" ) ) except socket . error : # if an error occured sending data over the socket raise error . ConnectionError ( "Error communicating with Chromecast" )