Absinthe.GraphqlWS.Socket.handle_message
You're seeing just the callback
handle_message
, go back to Absinthe.GraphqlWS.Socket module for more information.
Specs
handle_message(params :: term(), socket()) :: reply_message()
Handles messages that are sent to this process through send/2
, which have not been caught
by the default implementation. It must return a reply_message/0
.
If pushing content to the websocket, it must return a tuple in the form
{:push, {:text, message}, socket}
, where message
is JSON that represents a valid grapql-ws
message.
Example
alias Absinthe.GraphqlWS.Message
def handle_message({:thing, thing}, socket) do
{:ok, assign(socket, :thing, thing)}
end
def handle_message({:send, id, payload}, socket) do
{:push, {:text, Message.Next.new(id, payload)}, socket}
end
def handle_message(_msg, socket) do
{:ok, socket}
end