signal provide upon request WS.

This commit is contained in:
Miroslav Šedivý 2020-11-30 18:27:25 +01:00
parent 2e090eb54d
commit 743ab2bf6a
4 changed files with 4 additions and 7 deletions

View File

@ -6,7 +6,7 @@ const (
)
const (
SIGNAL_REQUEST = "signal/request" // TODO: New.
SIGNAL_REQUEST = "signal/request"
SIGNAL_ANSWER = "signal/answer"
SIGNAL_PROVIDE = "signal/provide"
)

View File

@ -47,6 +47,8 @@ func (h *MessageHandlerCtx) Message(session types.Session, raw []byte) error {
var err error
switch header.Event {
// Signal Events
case event.SIGNAL_REQUEST:
err = h.signalRequest(session)
case event.SIGNAL_ANSWER:
payload := &message.SignalAnswer{}
err = utils.Unmarshal(payload, raw, func() error {

View File

@ -7,11 +7,6 @@ import (
)
func (h *MessageHandlerCtx) SessionCreated(session types.Session) error {
// send sdp and id over to client
if err := h.signalProvide(session); err != nil {
return err
}
return nil
}

View File

@ -6,7 +6,7 @@ import (
"demodesk/neko/internal/types/message"
)
func (h *MessageHandlerCtx) signalProvide(session types.Session) error {
func (h *MessageHandlerCtx) signalRequest(session types.Session) error {
sdp, lite, ice, err := h.webrtc.CreatePeer(session)
if err != nil {
return err