Website.set_ws_validation#
- Website.set_ws_validation(func)#
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
TrueorFalse. If the function returnsFalse, 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
TrueorFalse.
See also
flask_sock,simple_websockets