Module: Hydna

Defined in:
lib/hydna.rb

Constant Summary collapse

DEFAULT_CHANNEL =
1
MAX_PAYLOAD_SIZE =
0xFFF8
MAX_CHANNEL_VALUE =
0xFFFFFFFF
MAX_TOKEN_SIZE =
0xFFFF

Class Method Summary collapse

Class Method Details

.emit(domain, data, ctoken = nil, agent = 'hydna-ruby-push') ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hydna.rb', line 12

def self.emit(domain, data, ctoken=nil, agent='hydna-ruby-push')

  headers = {
    'Content-Type' => 'text/plain',
    'User-Agent' => agent,
    'X-Emit' => 'yes'
  }
  
  send(domain, headers, data)

end

.push(domain, data, prio = 0, ctoken = nil, agent = 'hydna-ruby-push') ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hydna.rb', line 24

def self.push(domain, data, prio=0, ctoken=nil, agent='hydna-ruby-push')

  headers = {
    'Content-Type' => 'text/plain',
    'User-Agent' => agent
  }
  
  prio = clean_prio(prio)

  headers['X-Priority'] = prio.to_s()

  send(domain, headers, data)

end