In IOS, which client is used to request absinthe websocket?

I can’t find anything useful :sob:

Apollo seems to have some websockets support since PR #220.

There’s also LiveGQL for subscriptions.

1 Like

Absinthe itself does not have any particular transport restrictions or capabilities. If you want to use it with Absinthe.Phoenix over phoenix websockets, you’ll need an iOS phoenix channels client.

From there you join a specific channel and push docs at the server.

1 Like

Now the solution is to use https://github.com/davidstump/SwiftPhoenixClient to connect the __absinthe__:control Channel

Apollo uses its own WebSocket protocol that is different from the one that Absinthe.Phoenix drives. If you can use the Phoenix client as @benwilson512 suggests then that is probably your best bet.

I began a library that connects a client using the Apollo client’s web socket protocol. That project is here:

And it works to a Proof of Concept level. I have not had the opportunity to drive it farther than that.

1 Like

Hey, any chance of putting put a guide for phoenix on this? Im on the elixir slack if you want to chat there as well. I pinged you a couple times.

I’ve been looking into this the last few days so just wanted to give an update. My need is: Apollo (iOS) to connect to Absinthe GraphQL using websockets.

Currently 2 approaches you can take:

Modify the client:

This involves adding the above as the web socket transport when you create your Apollo client. The tricky part here is keeping the library up to date with it’s dependencies: Apollo & SwiftPhoenixClient. I’m currently testing this library with latest Apollo & SwiftPhoenixClient in my fork. Seems good so far.

Modify the server:

There are packages available that modify the elixir backend to support the graphql_ws and the subscriptions_transport_ws protocol, namely absinthe_graphql_ws | Hex and GitHub - maartenvanvliet/subscriptions-transport-ws: Socket library implementation of the subscriptions-transport-ws graphql subscription protocol for Absinthe

I’ve done less exploration here on the above “modifying the server approach”, but thanks to maartenvanvliet (Maarten van Vliet) · GitHub for pointing them out.

I’d be interested to hear anyone’s experience with either approach, pros / cons. etc.

1 Like