Example #1
0
func keepalive(session *janus.Session, stop chan struct{}) {
	ticker := time.NewTicker(time.Second * 30)

	for {
		select {
		case <-ticker.C:
			session.KeepAlive()
		case <-stop:
			ticker.Stop()
			return
		}
	}
}
Example #2
0
func watch(session *janus.Session, handle *janus.Handle, stop chan struct{}) {
	for {
		msg := <-handle.Events
		switch msg := msg.(type) {
		case *janus.MediaMsg:
			if msg.Receiving == "false" {
				handle.Detach()
				session.Destroy()
				close(stop)
				return
			}
		}
	}
}