Module: SockJS::Transports::WSDebuggingMixin

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

Instance Method Summary collapse

Instance Method Details

#close(*args) ⇒ Object



46
47
48
49
# File 'lib/sockjs/transports/websocket.rb', line 46

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

#fix_buggy_input(*args) ⇒ Object



40
41
42
43
44
# File 'lib/sockjs/transports/websocket.rb', line 40

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



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sockjs/transports/websocket.rb', line 28

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