Esempio n. 1
0
 def connect(self):
     if self.current_printer().is_authenticated:
         async_to_sync(self.channel_layer.group_add)(
             channels.commands_group_name(self.current_printer().id),
             self.channel_name)
         self.accept()
     else:
         self.close()
Esempio n. 2
0
 def connect(self):
     if self.current_printer().is_authenticated:
         async_to_sync(self.channel_layer.group_add)(
             channels.commands_group_name(self.current_printer().id),
             self.channel_name)
         redis.printer_settings_set(self.current_printer().id,
                                    {'using_ws': 'True'})
         # self.accept('binary')
         # self.accept('base64')
         self.accept()
     else:
         self.close()
Esempio n. 3
0
 def disconnect(self, close_code):
     LOGGER.warn("OctoPrintConsumer: Closed websocket with code: {}".format(
         close_code))
     async_to_sync(self.channel_layer.group_discard)(
         channels.commands_group_name(self.current_printer().id),
         self.channel_name)