Module: SockJS::Transports::WSDebuggingMixin

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

Instance Method Summary collapse

Instance Method Details

#close(*args) ⇒ Object



50
51
52
53
# File 'lib/sockjs/transports/websocket.rb', line 50

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

#fix_buggy_input(*args) ⇒ Object



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

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



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/sockjs/transports/websocket.rb', line 32

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