Sha256: 02c876200489cd99b08622ebc1708492cd29ad140b2a5dda185995fbf5bb3ca2

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

#!/usr/bin/env ruby

require "../../lib/async/slack"

token = ENV['SLACK_TOKEN']

Async::Slack.connect(token: token) do |client|
	client.real_time.connect do |connection|
		id = 1
		
		Async do |task|
			while true
				task.sleep 5
				
				Async.logger.info(self) {"Sending Slack Ping Frame #{id}..."}
				
				connection.write({type: "ping", id: id})
				connection.flush
				
				id += 1
			end
		end
		
		while message = connection.read
			Async.logger.info(self) {"message: #{message.inspect}"}
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
async-slack-0.3.0 examples/alive/slack.rb
async-slack-0.2.1 examples/alive/slack.rb
async-slack-0.2.0 examples/alive/slack.rb
async-slack-0.1.1 examples/alive/slack.rb