2020-11-01 16:09:48 +01:00
|
|
|
package handler
|
2020-10-22 16:54:50 +02:00
|
|
|
|
|
|
|
import (
|
2020-10-28 19:15:48 +01:00
|
|
|
"demodesk/neko/internal/types"
|
|
|
|
"demodesk/neko/internal/types/event"
|
|
|
|
"demodesk/neko/internal/types/message"
|
2020-10-22 16:54:50 +02:00
|
|
|
)
|
|
|
|
|
2020-11-30 18:27:25 +01:00
|
|
|
func (h *MessageHandlerCtx) signalRequest(session types.Session) error {
|
2020-12-06 18:49:20 +01:00
|
|
|
if !session.CanWatch() {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-11-01 16:09:48 +01:00
|
|
|
sdp, lite, ice, err := h.webrtc.CreatePeer(session)
|
2020-10-22 16:54:50 +02:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-11-18 20:30:33 +01:00
|
|
|
return session.Send(
|
|
|
|
message.SignalProvide{
|
|
|
|
Event: event.SIGNAL_PROVIDE,
|
|
|
|
SDP: sdp,
|
|
|
|
Lite: lite,
|
|
|
|
ICE: ice,
|
|
|
|
})
|
2020-10-22 16:54:50 +02:00
|
|
|
}
|
|
|
|
|
2020-11-01 16:09:48 +01:00
|
|
|
func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error {
|
2020-11-14 16:09:00 +01:00
|
|
|
return session.SignalAnswer(payload.SDP)
|
2020-10-22 16:54:50 +02:00
|
|
|
}
|