def send(self, message, type, fin=True, status_code=None): # here we check if we're sending our custom 'latin_1' # message type, and add deflate compression to it by compressing # the payload and turning the first reserved bit on. if type == 'latin_1': self.sock.sendall( wscon.send( ws.Data( compress(message), type, fin, status_code, rsv_1=1))) else: self.sock.sendall( wscon.send(ws.Data(message, type, fin, status_code)))
def ws_send(self, message, type, fin=True, status_code=None): self.sock.sendall( self.ws_conn.send(ws.Data(message, type, fin, status_code)))
async def ws_send(self, message, type): await self.sock.sendall(self.wcon.send(ws.Data(message, type, True)))
async def send(self, sender, message, type): await self.sock.sendall( self.wcon.send( ws.Data('|'.join(map(str, sender)) + ': ' + message, type, True)))
async def server_send(self, message, type): await self.sock.sendall( self.wcon.send( ws.Data('*' * 5 + 'Chat|Server:' + message, type, True)))
async def ws_send(sock, message, type, fin=True, status_code=None): await sock.sendall(wscon.send(ws.Data(message, type, fin, status_code)))