Major Props to DDP-Apollo! Galaxy + Apollo, and HTTPS + Subscriptions on Localhost

I would like to give some major appreciation here to Swydo DDP-Apollo from @jamiter at Swydo. It took care of two things I had spent many hours trying to solve.

HTTPS on Localhost
I needed to get HTTPS on my local dev system. I got it working for most purposes, but the client wouldn’t connect to the Apollo subscription endpoint. I tried all kinds of different client and server setup code I found in the Apollo docs and on SO, but on my system, none of it was working with HTTPS.

Finally I decided to try out DDP-Apollo. BOOM. It worked immediately. @jamiter provides the client and server setup code and not only did it all work the first time – it cut the number of lines of setup code on client and server in half.

APOLLO on Galaxy
This week I’ve been trying to get my app working on Galaxy. Installation for the Meteor app was a breeze – very easy! But MDG Galaxy doesn’t really speak Apollo yet. I was trying to get Apollo working on Galaxy and I was told by Galaxy support:

Incoming traffic: You can only accept incoming traffic over the standard HTTP/HTTPS ports (80/443), not arbitrary ports. If you want an additional websocket server on top of the one built into Meteor, you should separate it by using a different URL path, not a different port.

This was giving me a lot of questions:

  • Do I need an entirely separate domain? Would my app be running separately on each URL path???

Well, the thing about DDP-Apollo is, it runs all your Apollo calls over the same port Meteor uses for DDP. So I wondered, with DDP-Apollo… would it solve all those things?

Well, I pushed my app to Galaxy, and again, BOOM, it just worked – including Apollo subscriptions!

Major props to @jamiter and DDP-Apollo!

4 Likes

I’ve never had trouble with apollo apps on galaxy-- what exactly happened?

I think ddp-apollo is the right path if you want to migrate your Meteor app, if you’re starting with Apollo-oriented Meteor App from the beginning, let go of DDP.

@a.com, most of the docs I saw for server setup, (an example from ApolloGraphQL docs is here), require you to declare a port for Apollo subscriptions. When I asked Galaxy support about how to do this on Galaxy, I got the response quoted above.

It’s great that you have an alternative way. Could you please post your client and server Apollo setup code here for reference?

The only thing I’m using DDP for at this point is Meteor accounts. I would be very happy to find an Apollo-only option for this. What would be a good approach for accounts that would be Apollo-only? Could the user id still be included in calls to Apollo resolvers?

Just read the full documentation of https://github.com/cult-of-coders/apollo these things have already been done for a while now.

3 Likes