def sendPatch(self, p: Patch): # this is where we could concatenate little patches into a # bigger one. Often, many statements will cancel each # other out. # also who's going to accumulate patches when server is down, # or is that not allowed? if self.connectionId is None: raise ValueError("can't send patches before we get an id") body = p.makeJsonRepr() log.debug(f'connectionId={self.connectionId} sending patch {len(body)} bytes') self.sendMessage(body.encode('utf8'))
def sendPatch(self, p: Patch): self.sendMessage(p.makeJsonRepr())