Website.set_ws_validation#

Website.set_ws_validation(func)[source]#

Validate simple_websocket.ws.Server object before sending and accepting data.

ToUI uses Flask-Sock for websocket communication. Flask-Sock generates a simple_websocket.ws.Server object when a connection is established. If you wanted to access this object before sending and receiving data, input a function that has one argument ws. This function should either return True or False. If the function returns False, no data will be sent or received using ToUI with the client.

Parameters:

func (Callable) – A function that validates the Server object. It should have one argument ws and should either return True or False.

See also

flask_sock, simple_websockets