<commit_before>require 'faye'
require 'redis'
require "faye_extension/version"
require 'faye/extension'
require "faye_extension/extension_helpers"

require "net/http"


Faye::Extension.send :include, FayeExtension::Helpers

require "faye_extension/extensions"
  
  
module FayeExtension
  def self.post_message(channel, data, ext={})
    message = {:channel => channel, :data => data, :ext => ext}
    uri = URI.parse("http://localhost:9292/fayeserver")
    Net::HTTP.post_form(uri, :message => message.to_json)
  end
end
  
# For testing
def get_recent_messages
  y Faye::Extension.new.instance_eval{ get_messages(channels_matching_subscriptions(['/**']), 0, -1) }
end

EM.next_tick do
  Faye::Extension.faye_client.publish('/foo', {action: "Server", text: 'A new faye server in-process client is online', timestamp:DateTime.now})<commit_msg>Change FayeExtension.post_message to post_http_message.<commit_after>require 'faye'
require 'redis'
require "faye_extension/version"
require 'faye/extension'
require "faye_extension/extension_helpers"

require "net/http"


Faye::Extension.send :include, FayeExtension::Helpers

require "faye_extension/extensions"
  
  
module FayeExtension
  def self.post_http_message(channel, data, ext={})
    message = {:channel => channel, :data => data, :ext => ext}
    uri = URI.parse("http://localhost:9292/fayeserver")
    Net::HTTP.post_form(uri, :message => message.to_json)
  end
end
  
# For testing
def get_recent_messages
  y Faye::Extension.new.instance_eval{ get_messages(channels_matching_subscriptions(['/**']), 0, -1) }
end

EM.next_tick do
  Faye::Extension.faye_client.publish('/foo', {action: "Server", text: 'A new faye server in-process client is online', timestamp:DateTime.now})
{'fraction_non_alphanumeric': 0.1361800346220427, 'fraction_numerical': 0.006924408540103866, 'mean_word_length': 5.72093023255814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2719278', 'n_tokens_mistral': 580, 'n_tokens_neox': 567, 'n_words': 126}