Skip to content

Cannot get realtime to work #127

Description

@djpate

I've tried to get realtime to work for the last 3 hours.

No message is ever sent and the queue just grows.

Did anyone get it working?

require 'eventmachine'
require 'ably'

log = Logger.new(STDOUT)
log.level = Logger::WARN

EventMachine.run do
  ably = Ably::Realtime.new(key: 'xxxx', logger: log)
  ably.connection.on do |state_change|
    puts state_change.current #=> :connected
    puts state_change.previous #=> :connecting
  end
  channel = ably.channels.get('sport')
  d = channel.attach do 
    loop do
      puts channel.attached?
      puts channel.publish('update', 'team' => 'Man United')
      sleep 1
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions