syft.workers.websocket_server

Module Contents

class syft.workers.websocket_server.WebsocketServerWorker(hook, host: str, port: int, id: Union[int, str] = 0, log_msgs: bool = False, verbose: bool = False, data: List[Union[torch.Tensor, AbstractTensor]] = None, loop=None, cert_path: str = None, key_path: str = None)

Bases: syft.workers.virtual.VirtualWorker, syft.federated.federated_client.FederatedClient

async _consumer_handler(self, websocket: websockets.WebSocketCommonProtocol)

This handler listens for messages from WebsocketClientWorker objects.

Parameters

websocket – the connection object to receive messages from and add them into the queue.

async _producer_handler(self, websocket: websockets.WebSocketCommonProtocol)

This handler listens to the queue and processes messages as they arrive.

Parameters

websocket – the connection object we use to send responses back to the client.

_recv_msg(self, message: bin)
async _handler(self, websocket: websockets.WebSocketCommonProtocol, *unused_args)

Setup the consumer and producer response handlers with asyncio.

Parameters

websocket – the websocket connection to the client

start(self)

Start the server

list_objects(self, *args)
objects_count(self, *args)