subzerocloud / postgrest-starter-kit

Starter Kit and tooling for authoring REST API backends with PostgREST
MIT License
744 stars 71 forks source link

rabbitMQ stomp plugin #58

Closed riccardodivirgilio closed 4 years ago

riccardodivirgilio commented 4 years ago

the amqp bridge readme says that by enabling the STOMP plugin you can archive real time communication. https://github.com/subzerocloud/pg-amqp-bridge I think it's worthwhile to add such integration directly in the repo, I need to do it in anycase for a project I'm using that is using this starter kit, so if you think it's worthwhile I might fork and then merge back here.

Do you have any suggestion on how this should be done? probably a new docker image that is installing the plugin and we need somehow to expose an endpoint that is forwarding all notifications...

thanks!

ruslantalpa commented 4 years ago

This is implemented here, you are welcome to adapt it for your needs though i don't think i'll add it to this repo. https://github.com/subzerocloud/subzero-starter-kit

Rabbitmq is setup like this https://github.com/subzerocloud/subzero-starter-kit/blob/master/docker-compose.yml#L119-L134 And openresty is setup like this https://github.com/subzerocloud/subzero-starter-kit/blob/master/openresty/nginx/rabbitmq.conf

which exposes the endpoinsts /rabbitmq/(stomp|ws)

You'll however need to adjust the lua code a bit in rabbitmq.conf (that is responsible for transparently authenticating stomp clients to rabbit) because it reads the token from a cookie (priavate code) and you'll need to read it from a header.

riccardodivirgilio commented 4 years ago

oh I see it was unclear to me that lua was already doing it, ok thanks for the heads up I'll play I bit more with it. I'll re-open it if necessary! thanks