wip: 0.2.7
实现了 rtc 握手和打开数据通道
This commit is contained in:
@ -61,9 +61,9 @@ func LocalWS() nf.HandlerFunc {
|
||||
func LocalOffer() nf.HandlerFunc {
|
||||
return func(c *nf.Ctx) error {
|
||||
type Req struct {
|
||||
Id string `json:"id"`
|
||||
Offer *controller.RoomOffer `json:"offer"`
|
||||
Candidate *controller.RoomCandidate `json:"candidate"`
|
||||
Id string `json:"id"`
|
||||
From string `json:"from"`
|
||||
Offer *controller.RoomOffer `json:"offer"`
|
||||
}
|
||||
|
||||
var (
|
||||
@ -75,7 +75,7 @@ func LocalOffer() nf.HandlerFunc {
|
||||
return c.Status(http.StatusBadRequest).JSON(map[string]string{"err": err.Error()})
|
||||
}
|
||||
|
||||
controller.RoomController.Offer(req.Id, req.Offer, req.Candidate)
|
||||
controller.RoomController.Offer(req.Id, req.From, req.Offer)
|
||||
|
||||
return resp.Resp200(c, req.Offer)
|
||||
}
|
||||
@ -102,3 +102,25 @@ func LocalAnswer() nf.HandlerFunc {
|
||||
return resp.Resp200(c, req)
|
||||
}
|
||||
}
|
||||
|
||||
func LocalCandidate() nf.HandlerFunc {
|
||||
return func(c *nf.Ctx) error {
|
||||
type Req struct {
|
||||
Id string `json:"id"`
|
||||
Candidate *controller.RoomCandidate `json:"candidate"`
|
||||
}
|
||||
|
||||
var (
|
||||
err error
|
||||
req = new(Req)
|
||||
)
|
||||
|
||||
if err = c.BodyParser(req); err != nil {
|
||||
return c.Status(http.StatusBadRequest).JSON(map[string]string{"err": err.Error()})
|
||||
}
|
||||
|
||||
controller.RoomController.Candidate(req.Id, req.Candidate)
|
||||
|
||||
return resp.Resp200(c, req)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user