<commit_before>Rx = require "rx"
Faye = require "faye"

faye = new Faye.NodeAdapter(mount: "/faye", timeout: 45)
exports.publish = (args...) -> faye.getClient().publish(args...)
exports.subscribe = (args...) -> faye.getClient().subscribe(args...)
exports.attach = (args...) -> faye.attach(args...)

faye.asObservable = (event_type) ->
  subj = new Rx.Subject()
  subj.callback = (params...) -> subj.onNext(params)
  faye.bind(event_type, subj.callback)
  subj

faye.bind('subscribe', ([clientId, channel]) ->
  console.log("FAYE subscribe", clientId, channel))

faye.bind('handshake', (clientId) ->
  console.log("FAYE handshake", clientId))

faye.bind('disconnect', ([clientId, channel]) ->
  console.log("FAYE disconnect", clientId, channel))

faye.bind('unsubscribe', ([clientId, channel]) ->
  console.log("FAYE unsubscribe", clientId, channel))<commit_msg>fix arg arity in new faye bindings<commit_after>Rx = require "rx"
Faye = require "faye"

faye = new Faye.NodeAdapter(mount: "/faye", timeout: 45)
exports.publish = (args...) -> faye.getClient().publish(args...)
exports.subscribe = (args...) -> faye.getClient().subscribe(args...)
exports.attach = (args...) -> faye.attach(args...)

faye.asObservable = (event_type) ->
  subj = new Rx.Subject()
  subj.callback = (params...) -> subj.onNext(params)
  faye.bind(event_type, subj.callback)
  subj

faye.bind('subscribe', (clientId, channel) ->
  console.log("FAYE subscribe", clientId, channel))

faye.bind('handshake', (clientId) ->
  console.log("FAYE handshake", clientId))

faye.bind('disconnect', (clientId, channel) ->
  console.log("FAYE disconnect", clientId, channel))

faye.bind('unsubscribe', (clientId, channel) ->
  console.log("FAYE unsubscribe", clientId, channel))
{'fraction_non_alphanumeric': 0.19573978123200922, 'fraction_numerical': 0.002302820955670697, 'mean_word_length': 4.624595469255663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '1969780', 'n_tokens_mistral': 607, 'n_tokens_neox': 584, 'n_words': 121}