class MyConsumers(JsonWebsocketConsumer): channel_session_user = True
strict_ordering = True
method_mapping = { "websocket.connect": "connect", "websocket.receive": "receive", "websocket.disconnect": "disconnect", }
def connection_groups(self, **kwargs): return ["all-clients", ]
def connect(self, message, **kwargs): # Accepts connections and returns {'Accepted': Trie} subscription_manager.SubscriptionManager.connect_endpoint(message)
def receive(self, content, **kwargs): # Registers groups and stores data in redis cache. subscription_manager.SubscriptionManager.receive_endpoint(content)
def disconnect(self, message, **kwargs): ...
urlpatterns = [ ... url(r'^graphql', csrf_exempt(GraphQLView.as_view(graphiql=settings.DEBUG))), url(r'^admin/', admin.site.urls), url(r'^support/', include(support_urls)), url(r'^django-rq/', include('django_rq.urls')),]
subscription_routing = [ route_class(consumers.QuantumConsumers)]
channel_routing = [ include(subscription_routing, path=r"^/ws/subscriptions"),]
class Ping(models.Model): support_session = models.OneToOneField(SupportSession, related_name="ping") client_ping = models.DateTimeField(...) support_ping = models.DateTimeField(...)
# Sets up a post_saveModelSignalReceiver.connect_receivers(Ping)
class PingMutation(graphene.ClientIDMutation):
class Input: support_session_id = graphene.ID()
ping = graphene.Field(PingNode)
@classmethod def mutate_and_get_payload(cls, args, context, info): session_id = from_global_id(args.get('support_session_id'))[1] pings = support_models.Ping.objects.get(support_session__id=session_id)
pings.support_last_ping = datetime.datetime.now()
# I can see this debug message, before the save. logger.debug('SupportPingMutation:pre-save')
# Will trigger the signal... pings.save()
# The code never reaches this point. logger.debug('SupportPingMutation:post-save')
return cls(ping=pings)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2ae1ece5-24ff-4754-9d21-b8207117292e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b12520a9-cc7e-4e3e-9962-7fa0e3b7c7e6%40googlegroups.com.