Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to subscribe from the server #47

Closed
softmonkeyjapan opened this issue Apr 11, 2018 · 2 comments
Closed

Ability to subscribe from the server #47

softmonkeyjapan opened this issue Apr 11, 2018 · 2 comments

Comments

@softmonkeyjapan
Copy link

softmonkeyjapan commented Apr 11, 2018

Hi,

We are using Ably to maintain the state of our APIs, mainly built using Ruby on Rails. Your Ruby SDK (https://github.com/ably/ably-ruby#subscribing-to-a-channel) allows us to subscribe from the server like this using Ably::Realtime.new:

Thread.new do
  EventMachine.run do
    channel = ABLY_REALTIME.channels.get('identity')
    channel.subscribe('updateUser') do |msg|
      # code
    end
  end
end

However, we can't seems to be able to find the same feature for the PHP SDK. Is there any particular reason why it is not implemented ? Is there a workaround ? One of our API is built in PHP and we are struggling syncing it with the rest of our stack.

Thanks for reading this.

@paddybyers
Copy link
Member

The PHP implements the REST library only (see https://www.ably.io/download) and so do not support realtime (websocket) connections and channel subscriptions.

We don't have any plans at present to extend PHP to a realtime library.

Might an alternative be to use an MQTT client library (eg https://github.com/oliverlorenz/phpMqttClient ?). Ably supports MQTT subscriptions (https://support.ably.io/support/solutions/articles/3000060409-why-would-i-use-mqtt-over-ably-s-realtime-protocol-)

@softmonkeyjapan
Copy link
Author

@paddybyers thanks a lot for those explanations. For now, we've created a NodeJs microservice that is responsible of feeding our PHP API with the realtime data. I will take a look at the MQTT alternative which sounds better.
Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants