absinthe-graphql / absinthe-socket

Core JavaScript support for Absinthe WS-based operations
MIT License
150 stars 75 forks source link

Continued Maintenance #66

Open kyleboe opened 1 year ago

kyleboe commented 1 year ago

I fully acknowledge that the last few years have been a roller coaster so I bring this up with all the empathy I can. There are several valuable PRs that have been opened over the last couple years without much input from those currently maintaining this repo. I would be happy to help with maintenance if the need is there. Ultimately, I want to do my part to ensure that the OSS on which I depend does not die on the vine.

TL;DR Thoughts on adding maintainers?

benwilson512 commented 1 year ago

Hi @kyleboe thank you for your very thoughtfully worded issue.

Additional maintainers to the project would be very welcome. To be frank, there is not one current Absinthe maintainer with the relevant javascript skills to maintain this repo, as we're generally all on the backend Elixir side right now. If you are offering, I'd love to chat.

Notably though there is an alternative route that I think may be more sustainable: providing a Phoenix Websocket implementation that is compatible with Apollo Server's wire protocol. This would allow front end developers to simply use the standard, off the shelf apollo-link and go from there.

I believe there has already been some work done on this, but its status is unknown to me at the moment.

kyleboe commented 1 year ago

Thanks so much for the context. Admittedly, I don't have the strongest JS chops so I don't know that I am qualified enough to maintain this. However, if there is nobody else available, I am willing to assist.

Notably though there is an alternative route that I think may be more sustainable: providing a Phoenix Websocket implementation that is compatible with Apollo Server's wire protocol. This would allow front end developers to simply use the standard, off the shelf apollo-link and go from there.

I believe there has already been some work done on this, but its status is unknown to me at the moment.

Interesting, that definitely seems to be a more pragmatic approach. I will poke around the Apollo docs and see what can be done to this effect.

benwilson512 commented 1 year ago

https://github.com/easco/absinthe_apollo_sockets is one implementation. It looks like overall the apollo socket protocol is a lot simpler than phoenix channels. Probably the main concern I have is how testing it will go, as I'd like to do that end to end, and that introduces a need to keep a local apollo project up to date.

kyleboe commented 1 year ago

It looks like the library linked to in the README of easco/absinthe_apollo_sockets is no longer maintained (see: here). The updated Apollo docs also recommend using the graphql-ws standard/library. Maybe I am missing something, but could solely graphql-ws be used client-side?

maartenvanvliet commented 1 year ago

I recommend https://github.com/geometerio/absinthe_graphql_ws for using the graphql-ws protocol. I think by now all Apollo clients (iOS/Kotlin/web) should have support for it.

One thing I've been meaning to look into is whether it's possible to do some kind of protocol negotiation. Then you could point the client at the socket and the backend would figure out which protocol is intended and use that.

kyleboe commented 1 year ago

@maartenvanvliet I think we are talking about the JS (client) side of things. Not necessarily consuming GQL via the backend (elixir/absinthe). Maybe I'm misunderstanding your recommendation though.

benwilson512 commented 1 year ago

@kyleboe It's actually super relevant. What @maartenvanvliet and I are saying is that instead of maintaining an Absinthe specific JS client, what we want to do is provide official Absinthe support on the Elixir side for the normal standard js client so that our relative lack of JS developers stops being a problem.

kyleboe commented 1 year ago

Ah I see! I misread the Usage section of the absinthe_graphql_ws readme. That makes total sense. Seems like a great route to take!

kyleboe commented 1 year ago

Ok yeah I just got everything running locally by implementing absinthe_graphql_ws and removing @absinthe/socket/@absinthe/socket-apollo-link dependency as well as the JS phoenix dependency.

I basically followed the Apollo docs here and ensured that the backend was set up as outlined in the absinthe_graphql_ws docs and it Just Worked:tm:.

Thanks so much for all the help @benwilson512 & @maartenvanvliet!

what we want to do is provide official Absinthe support on the Elixir side for the normal standard js client so that our relative lack of JS developers stops being a problem

This seems like a great way to go. If there are any PRs I can open to assist in this just let me know.

enewbury commented 1 year ago

Also had success using this library. Perhaps it would be valuable to add a section in the absinthe docs showcasing this as an alternative for folks who need to use Apollo V3