Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ logjam.exe
logjam
web-app/node_modules
web-app/dist
.vscode
logs.log
24 changes: 17 additions & 7 deletions lib/goldgorilla/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,31 @@ type JoinReqModel struct {
RoomId string `json:"roomId"`
}

// not the rtp direction like rtpsender or rtpreceiver; but the connection direction wether conn wants to send or recv
type ConnectionDirection string

const (
CDSend = "sendOnly"
CDRecv = "recvOnly"
)

type SendIceCandidateReqModel struct {
RoomPeerDTO
GGID uint64 `json:"ggid"`
ICECandidate interface{} `json:"iceCandidate"`
GGID uint64 `json:"ggid"`
ICECandidate interface{} `json:"iceCandidate"`
ConnDirection ConnectionDirection `json:"connectionDirection"`
}

type CreatePeerRPCModel struct {
RoomPeerDTO
CanPublish bool `json:"canPublish"`
IsCaller bool `json:"isCaller"`
GGID uint64 `json:"ggid"`
CanPublish bool `json:"canPublish"`
IsCaller bool `json:"isCaller"`
GGID uint64 `json:"ggid"`
ConnDirection ConnectionDirection `json:"connectionDirection"`
}

type SetSDPRPCModel struct {
RoomPeerDTO
GGID uint64 `json:"ggid"`
SDP interface{} `json:"sdp"`
GGID uint64 `json:"ggid"`
SDP interface{} `json:"sdp"`
}
16 changes: 9 additions & 7 deletions lib/goldgorilla/goldgorilla_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (a *HTTPRepository) isConfigured() bool {
return len(a.svcAddr) > 0
}

func (a *HTTPRepository) CreatePeer(roomId string, id uint64, canPublish bool, isCaller bool, ggid uint64) error {
func (a *HTTPRepository) CreatePeer(roomId string, id uint64, canPublish bool, isCaller bool, ggid uint64, connDirection ConnectionDirection) error {
if !a.isConfigured() {
return errors.New("gg repository not initialized yet")
}
Expand All @@ -42,9 +42,10 @@ func (a *HTTPRepository) CreatePeer(roomId string, id uint64, canPublish bool, i
RoomId: roomId,
ID: id,
},
CanPublish: canPublish,
IsCaller: isCaller,
GGID: ggid,
CanPublish: canPublish,
IsCaller: isCaller,
GGID: ggid,
ConnDirection: connDirection,
})
if err != nil {
return err
Expand All @@ -59,7 +60,7 @@ func (a *HTTPRepository) CreatePeer(roomId string, id uint64, canPublish bool, i
return nil
}

func (a *HTTPRepository) SendICECandidate(roomId string, id uint64, iceCandidate interface{}) error {
func (a *HTTPRepository) SendICECandidate(roomId string, id uint64, iceCandidate interface{}, connDirection ConnectionDirection) error {
if !a.isConfigured() {
return errors.New("gg repository not initialized yet")
}
Expand All @@ -69,7 +70,8 @@ func (a *HTTPRepository) SendICECandidate(roomId string, id uint64, iceCandidate
RoomId: roomId,
ID: id,
},
ICECandidate: iceCandidate,
ICECandidate: iceCandidate,
ConnDirection: connDirection,
})
if err != nil {
return err
Expand Down Expand Up @@ -190,7 +192,7 @@ func (a *HTTPRepository) ResetRoom(roomId string) (*uint64, error) {

func (a *HTTPRepository) Start(roomId string) error {
if a.svcAddr == "" {
return errors.New("HTTPRepository instance is not initialized yet(waiting for goldgorilla hook)...")
return errors.New("HTTPRepository instance is not initialized yet(waiting for goldgorilla hook)")
}

body, _ := getReader(map[string]string{"roomId": roomId})
Expand Down
4 changes: 2 additions & 2 deletions lib/goldgorilla/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package goldgorilla
type IGoldGorillaServiceRepository interface {
Start(roomId string) error
ResetRoom(roomId string) (*uint64, error)
CreatePeer(roomId string, id uint64, canPublish bool, isCaller bool, ggId uint64) error
SendICECandidate(roomId string, id uint64, iceCandidate interface{}) error
CreatePeer(roomId string, id uint64, canPublish bool, isCaller bool, ggId uint64, connDirection ConnectionDirection) error
SendICECandidate(roomId string, id uint64, iceCandidate interface{}, connDirection ConnectionDirection) error
SendAnswer(roomId string, peerId uint64, answer interface{}) error
SendOffer(roomId string, peerId uint64, offer interface{}) error
ClosePeer(roomId string, id uint64) error
Expand Down
Loading