I use Django Channels to retrieve the data from Django Restful (DRF) serializer (I use channels because database is large and if I call for the data directly it results in a server timeout).
What I struggle with (perhaps I don't understand something about how DRF works), is how to get the html representation of Browsable API. So basically what I need to do is to send back as html a response based on BrowsableAPIRenderer when a person connects via WebSocket:
def connect(self, message, **kwargs):
myobj = MyObj.objects.filter(code=self.obj_code)
serializer = MyObjSerializer(myobj, many=True)
self.send(Response(serializer.data))
But that results in an error Response is not JSON serializable
.