2020-11-02 04:09:48 +13:00
|
|
|
package handler
|
2020-10-23 03:54:50 +13:00
|
|
|
|
|
|
|
import (
|
2020-10-29 07:15:48 +13:00
|
|
|
"demodesk/neko/internal/types"
|
|
|
|
"demodesk/neko/internal/types/event"
|
|
|
|
"demodesk/neko/internal/types/message"
|
2020-10-23 03:54:50 +13:00
|
|
|
)
|
|
|
|
|
2020-11-02 04:09:48 +13:00
|
|
|
func (h *MessageHandlerCtx) signalProvide(session types.Session) error {
|
|
|
|
sdp, lite, ice, err := h.webrtc.CreatePeer(session)
|
2020-10-23 03:54:50 +13:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-11-15 04:09:00 +13:00
|
|
|
return session.Send(message.SignalProvide{
|
2020-10-23 03:54:50 +13:00
|
|
|
Event: event.SIGNAL_PROVIDE,
|
2020-11-01 10:43:47 +13:00
|
|
|
ID: session.ID(),
|
2020-10-23 03:54:50 +13:00
|
|
|
SDP: sdp,
|
|
|
|
Lite: lite,
|
|
|
|
ICE: ice,
|
2020-11-15 04:09:00 +13:00
|
|
|
})
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|
|
|
|
|
2020-11-02 04:09:48 +13:00
|
|
|
func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error {
|
2020-11-01 09:46:29 +13:00
|
|
|
session.SetName(payload.DisplayName)
|
2020-11-15 04:09:00 +13:00
|
|
|
return session.SignalAnswer(payload.SDP)
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|