mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
31 lines
622 B
Go
31 lines
622 B
Go
package handler
|
|
|
|
import (
|
|
"demodesk/neko/internal/types"
|
|
"demodesk/neko/internal/types/event"
|
|
"demodesk/neko/internal/types/message"
|
|
)
|
|
|
|
func (h *MessageHandlerCtx) signalRequest(session types.Session) error {
|
|
if !session.CanWatch() {
|
|
return nil
|
|
}
|
|
|
|
sdp, lite, ice, err := h.webrtc.CreatePeer(session)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return session.Send(
|
|
message.SignalProvide{
|
|
Event: event.SIGNAL_PROVIDE,
|
|
SDP: sdp,
|
|
Lite: lite,
|
|
ICE: ice,
|
|
})
|
|
}
|
|
|
|
func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalAnswer) error {
|
|
return session.SignalAnswer(payload.SDP)
|
|
}
|