Open
Description
There are some valid use cases for running subscriptions (websockets) from a separate url to the rest of the graph. For example, this allows me to route these differently using nginx.
Graphene-Django provided a setting for this. Could we add another setting for this, or at least a clean way to override the functionality.
I have currently achieved this by creating the following django view, and manually replacing the html. But this approach is brittle, as it depends on the exact html returned.
from django.http import HttpRequest
from strawberry.django.views import GraphQLView
class CustomGraphQLView(GraphQLView):
def _render_graphiql(self, request: HttpRequest, context=None):
response = super()._render_graphiql(request, context)
response.content = response.content.replace(
b'url.replace(/(http)(s)?\:\/\//, "ws$2://");',
b'url.replace(/(http)(s)?\:\/\//, "ws$2://").replace(/\/graphql/, "/ws/graphql");'
)
return response