$(function() {

  if (room) {

    var messages = new Chamber.Collections.MessagesCollection
    messages.url = '/rooms/' + room.id + '/messages'
    
    var participants = new Chamber.Collections.ParticipantsCollection
    participants.url = '/rooms/' + room.id + '/participants'
    
    var room_show_view = new Chamber.Views.Rooms.ShowView(
      {
        messages: messages,
        participants: participants,
        model: room,
        el: $("#room")
      }
    )

    var jug = new Juggernaut({
      secure: false,
      host: 'chamber-juggernaut.herokuapp.com',
      host: 'localhost',
      port: 5000,
      transports: ['xhr-polling', 'jsonp-polling']
    })
    //var jug = new Juggernaut()
    
    jug.subscribe("/observer", function(data){
        if (data.klass == 'Message') {
          message = new Chamber.Models.Message(data.record)
          messages.add(message)
        } else if (data.klass == "Participant" && data.record.room.id == room.id) {
          participant = new Chamber.Models.Participant(data.record)
          participants.add(participant)
        }
    })
  }
})
$(function() {

  if (room) {

    var messages = new Chamber.Collections.MessagesCollection
    messages.url = '/rooms/' + room.id + '/messages'
    
    var participants = new Chamber.Collections.ParticipantsCollection
    participants.url = '/rooms/' + room.id + '/participants'
    
    var room_show_view = new Chamber.Views.Rooms.ShowView(
      {
        messages: messages,
        participants: participants,
        model: room,
        el: $("#room")
      }
    )

    var jug = new Juggernaut({
      secure: false,
      host: 'chamber-juggernaut.herokuapp.com',
      port: 5000,
      transports: ['xhr-polling', 'jsonp-polling']
    })
    //var jug = new Juggernaut()
    
    jug.subscribe("/observer", function(data){
        if (data.klass == 'Message') {
          message = new Chamber.Models.Message(data.record)
          messages.add(message)
        } else if (data.klass == "Participant" && data.record.room.id == room.id) {
          participant = new Chamber.Models.Participant(data.record)
          participants.add(participant)
        }
    })
  }
})
Update juggernaut settings