Packages

Plug support for AbsinthePlugCache, the GraphQL toolkit for Elixir

Current section

Files

Jump to
absinthe_plug_cache lib absinthe validation no_subscription_on_http.ex
Raw

lib/absinthe/validation/no_subscription_on_http.ex

defmodule AbsinthePlugCache.GraphiQL.Validation.NoSubscriptionOnHTTP do
@moduledoc false
use Absinthe.Phase
alias Absinthe.Blueprint
def run(blueprint, _) do
case Blueprint.current_operation(blueprint) do
%{type: :subscription} ->
{:error, {:http_method, "Subscriptions cannot be run over HTTP. Please configure a websocket connection"}}
_ ->
{:ok, blueprint}
end
end
end