Module: SockJS::Transports::WSDebuggingMixin

Defined in:
lib/sockjs/transports/websocket.rb

Instance Method Summary collapse

Instance Method Details

#close(*args) ⇒ Object



43
44
45
46
# File 'lib/sockjs/transports/websocket.rb', line 43

def close(*args)
  SockJS.debug "WS#close(#{args.inspect[1..-2]})"
  super(*args)
end

#fix_buggy_input(*args) ⇒ Object



37
38
39
40
41
# File 'lib/sockjs/transports/websocket.rb', line 37

def fix_buggy_input(*args)
  data = 'c[3000,"Go away!"]'
  SockJS.debug "[ERROR] Incorrect input: #{args.inspect}, changing to #{data} for now"
  return data
end

#send_data(*args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sockjs/transports/websocket.rb', line 25

def send_data(*args)
  if args.length == 1
    data = args.first
  else
    data = fix_buggy_input(*args)
  end

  SockJS.debug "WS#send #{data.inspect}"

  super(data)
end