Example #1
0
 public void publish(bool dontStop)
 {
     if (!dontStop)
     {
         IConnection connection = FluorineContext.Current.Connection;
         if (!(connection is IStreamCapableConnection))
         {
             return;
         }
         IStreamCapableConnection streamConnection = connection as IStreamCapableConnection;
         int           streamId = GetCurrentStreamId();
         IClientStream stream   = streamConnection.GetStreamById(streamId);
         if (!(stream is IBroadcastStream))
         {
             return;
         }
         IBroadcastStream bs = stream as IBroadcastStream;
         if (bs.PublishedName == null)
         {
             return;
         }
         IBroadcastScope bsScope = GetBroadcastScope(connection.Scope, bs.PublishedName);
         if (bsScope != null)
         {
             bsScope.Unsubscribe(bs.Provider);
             if (connection is BaseConnection)
             {
                 (connection as BaseConnection).UnregisterBasicScope(bsScope);
             }
         }
         bs.Close();
         streamConnection.DeleteStreamById(streamId);
     }
 }
Example #2
0
 public void publish(bool dontStop)
 {
     if (!dontStop)
     {
         IConnection connection = FluorineContext.Current.Connection;
         if (connection is IStreamCapableConnection)
         {
             IStreamCapableConnection connection2 = connection as IStreamCapableConnection;
             int           currentStreamId        = this.GetCurrentStreamId();
             IClientStream streamById             = connection2.GetStreamById(currentStreamId);
             if (streamById is IBroadcastStream)
             {
                 IBroadcastStream stream2 = streamById as IBroadcastStream;
                 if (stream2.PublishedName != null)
                 {
                     IBroadcastScope broadcastScope = this.GetBroadcastScope(connection.Scope, stream2.PublishedName);
                     if (broadcastScope != null)
                     {
                         broadcastScope.Unsubscribe(stream2.Provider);
                         if (connection is BaseConnection)
                         {
                             (connection as BaseConnection).UnregisterBasicScope(broadcastScope);
                         }
                     }
                     stream2.Close();
                     connection2.DeleteStreamById(currentStreamId);
                 }
             }
         }
     }
 }