     for clientID, session of sessions
       if session.stream == stream
         stream_ts = session.lastTimestamp
-    
+
     console.log "setBroadcastStream", stream_ts
     @emit 'broadcast_actual_changed', name
     for clientID, session of sessions
       if session.streamName == "broadcast" && session.stream != stream
         session.offsetTimestamp[avType] = session.lastTimestamp[avType] - stream_ts[avType]
-        
+
         if (avType == 'audio')
           session.audio_stream = stream
-        
+
         if (avType == 'video')
           session.stream = stream
           session.isWaitingForKeyFrame = true
-       
+
         session.stream_switched = true
         console.log "switched stream", avType, session.offsetTimestamp[avType]
-    
+
 
   on: (event, listener) ->
     if @eventListeners[event]?

        })
      ]

    
    onBWDone = createAMF0CommandMessage
      chunkStreamID: 3
      timestamp: 0

    if publishingType isnt 'live'
      console.log "[rtmp] warn: publishing type other than 'live' is not supported: #{publishingType}; using 'live'"
    console.log "[rtmp] publish: stream=#{publishingName} publishingType=#{publishingType}"

    match = /^([^?]*)\??(.*)/.exec publishingName
    # parse query string from publishingName
    streamName = match[1]

    @stream = getStreamByName(streamName)
    @stream.query = qs.parse(match[2]);

