play = exports ? this

socket = new WebSocket('ws://<%= Play.config.hostname %>/realtime')

socket.onopen = () ->

socket.onmessage = (message) ->
  song = JSON.parse(message.data).now_playing

  if song
    play.renderNowPlaying(song)

  list = listFromJson(JSON.parse(message.data))
  songs = Mustache.to_html(templates.list,list,templates)
  $('#songs').html(songs)

play = exports ? this

socket = new WebSocket('wss://<%= Play.config.hostname %>/realtime')

socket.onopen = () ->

socket.onmessage = (message) ->
  song = JSON.parse(message.data).now_playing

  if song
    play.renderNowPlaying(song)

  list = listFromJson(JSON.parse(message.data))
  songs = Mustache.to_html(templates.list,list,templates)
  $('#songs').html(songs)

Secure like a motherfucker. This'll probably break everyone else though.
Secure like a motherfucker. This'll probably break everyone else though.
