Wowza Community

How to terminate a HTTP Session when it is stilll running?

Hi everyone,

I want to terminate a http session which is running.

How can I do that.

Thank you.

Hi there, take a look at this guide:

How to control access to an HTTP stream (cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming)

Salvadore

Hungnguyen,

You can do something like this:

String userID="123";
   List<IHTTPStreamerSession> HTTPClients = ThisAppIns.getHTTPStreamerSessions();
   Iterator<IHTTPStreamerSession> HTTPClientIter = HTTPClients.iterator();
   IHTTPStreamerSession ThisHTTPClient;
          while ( HTTPClientIter.hasNext() )  
                {  
                       ThisHTTPClient = HTTPClientIter.next();
                       if (userID.equalsIgnoreCase(ThisHTTPClient.getQueryStr()))
                    		   {
						   ThisHTTPClient.rejectSession();
						   ThisHTTPClient.shutdown();
                    		   }  
                }

Richard

Hungnguyen,

There is nothing built-in to support that. Assuming you are using the Load Balancer, that would be a likely place to manage connections. You might use SharedObjects or HashMap in a HTTPProvider, which would be the entry point for HTTP playback clients. You check check querystring > accept (reject) > check Load Balancer for least loaded server > Return html with video tag and playback URL.

Richard

I want to close a http Session which is running.

In my case, I use userid is a parameter in the url. I want to close the first http session when the second http session is created. The first and second http session have the same userid.

For my instance, I request the first stream with http://wowza-server:1935/live/Stream1/playlist.m3u8?us=123456

And then, I also request the second stream with http://wowza-server:1935/live/Stream1/playlist.m3u8?us=123456.

How to Wowza Server close the first http Session, when the second http Session is created.

Hungnguyen

Hi Richard,

I follow your guide, but it also kills the current session.

I have fix like that

List<IHTTPStreamerSession> HTTPClients = appInstance
.getHTTPStreamerSessions();
Iterator<IHTTPStreamerSession> HTTPClientIter = HTTPClients.iterator();
IHTTPStreamerSession ThisHTTPClient;
getLogger().info("HTTPClients size: "  + HTTPClients.size());
while  (HTTPClientIter.hasNext()) {
[INDENT]ThisHTTPClient = HTTPClientIter.next();
if  (arrParams[0].equalsIgnoreCase(ThisHTTPClient.getQueryStr()) 
[INDENT][/INDENT]&& !ThisHTTPClient.getSessionId().equals(httpSession.getSessionId())
) {
[INDENT]ThisHTTPClient.rejectSession();
ThisHTTPClient.shutdown();[/INDENT]
}[/INDENT]
} 

And it works properly.

Thank you very much.

Hungnguyen

Hi Richard,

I have another issue, I have a media system with multi Edge servers. Such as what I discribe above, when the second http session is created, the first http session is closed. However, it 's just useful on the same edge server.

How about multi edge servers?

Hungnguyen