A simpler way to view django projects
default code for consumer snippet
1 file changed, +4 -4
+4-4snippets/python.json
| @@ -67,15 +67,15 @@ | ||
| 67 | 67 | "body": [ |
| 68 | 68 | "from channels.generic.websocket import AsyncWebsocketConsumer", |
| 69 | 69 | "", |
| 70 | - "class $1Consumer(AsyncWebsocketConsumer):", | |
| 70 | + "class ${1:MyConsumer}(AsyncWebsocketConsumer):", | |
| 71 | 71 | "\tasync def connect(self):", |
| 72 | - "\t\t$2", | |
| 72 | + "\t\t${2:print('Connected!')}", | |
| 73 | 73 | "", |
| 74 | 74 | "\tasync def disconnect(self, close_code):", |
| 75 | - "\t\t$3", | |
| 75 | + "\t\t${3:print('Disconnected!')}", | |
| 76 | 76 | "", |
| 77 | 77 | "\tasync def receive(self, text_data):", |
| 78 | - "\t\t$4" | |
| 78 | + "\t\t${4:print('Received:', text_data)}" | |
| 79 | 79 | ], |
| 80 | 80 | "description": "Snippet for a Django Channels consumer" |
| 81 | 81 | } |