absinthe-graphql / absinthe_graphql_ws

Add graphql-ws websocket transport for Absinthe
https://hexdocs.pm/absinthe_graphql_ws/overview.html
MIT License
66 stars 20 forks source link

Any plans to support SSE (the future)? #10

Open thojanssens opened 2 years ago

thojanssens commented 2 years ago

https://github.com/enisdenjo/graphql-sse/blob/master/PROTOCOL.md

https://www.the-guild.dev/blog/graphql-over-sse

sax commented 2 years ago

I think that SSE would need to be handled entirely differently from the way this library works, because SSE does not use UPGRADE requests to open websockets.

My quick read on this is that an absinthe SSE library could be a separate cowboy dispatcher. I see that there are some examples of how to implement SSE in cowboy, and a custom dispatcher can be registered.

In any case, I think that it would be a different library.

thojanssens commented 2 years ago

Would you know why the example code you referred to https://hexdocs.pm/phoenix/Phoenix.Endpoint.Cowboy2Adapter.html#module-custom-dispatch-options is not to be found in this lib https://github.com/mustafaturan/sse/blob/9edc7bc2397fb618861f15edb0a9ffd9ff8bb59e/README.md#phoenix-framework ?

How is it running without the dispatcher?

sax commented 2 years ago

It looks like that readme is written more around running plug directly in Cowboy, without Phoenix involved at all. I was assuming that since you were using absinthe_graphql_ws that you were using Phoenix, which is why I thought the custom dispatcher docs might be relevant.

thojanssens commented 2 years ago

It seems that Absinthe.Plug uses SSE here: https://github.com/absinthe-graphql/absinthe_plug/blob/v1.5.8/lib/absinthe/plug.ex#L359 Would you have any idea what this is about?