(flow: http.HTTPFlow)
| 13 | |
| 14 | |
| 15 | def websocket_message(flow: http.HTTPFlow): |
| 16 | assert flow.websocket is not None # make type checker happy |
| 17 | last_message = flow.websocket.messages[-1] |
| 18 | if last_message.is_text and "secret" in last_message.text: |
| 19 | last_message.drop() |
| 20 | ctx.master.commands.call( |
| 21 | "inject.websocket", flow, last_message.from_client, b"ssssssh" |
| 22 | ) |
| 23 | |
| 24 | |
| 25 | # Complex example: Schedule a periodic timer |