mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
signal provide upon request WS.
This commit is contained in:
parent
2e090eb54d
commit
743ab2bf6a
@ -6,7 +6,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
SIGNAL_REQUEST = "signal/request" // TODO: New.
|
||||
SIGNAL_REQUEST = "signal/request"
|
||||
SIGNAL_ANSWER = "signal/answer"
|
||||
SIGNAL_PROVIDE = "signal/provide"
|
||||
)
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user