Socketio payload checking/size limiting

We are using socketio channel for the communication with our bot. We need to perform various operations after checking the payload from the user. E.G. Rate limiting, restricting payload size etc. Could you suggest me an approach that I could follow.

After looking for I while I found out that maybe creating a custom channel will solve our problem. We picked up the following socket channel file to use as the template:

We are planning to make the payload validation changes in the aforementioned file. But we are still not sure if it is the correct way to go. Kindly advice us on it.

You are on the right track. You can check out this example on how to override the functionality (Custom Connectors). Basically, once you are done performing your validation, you just have to call on_new_message to actually perform the prediction.