var realtime_host = "<%= QuickSearch::Engine::APP_CONFIG['realtime_url'] %>"; var socket = io.connect(realtime_host); socket.emit('subscribe', {room: 'quicksearch-<%= Rails.env %>'}); socket.on('update', function(data){ console.log(data); if ('q' in data) { var item = '
  • ' + data.q + "
  • "; $('#realtime_searches ul').prepend(item); } });