wip: 0.2.3
1. websocket hook 2. rtc init ok
This commit is contained in:
@ -12,8 +12,8 @@ import (
|
||||
func LocalRegister() nf.HandlerFunc {
|
||||
return func(c *nf.Ctx) error {
|
||||
type Req struct {
|
||||
Candidate any `json:"candidate"`
|
||||
Offer any `json:"offer"`
|
||||
Candidate *controller.RoomCandidate `json:"candidate"`
|
||||
Offer *controller.RoomOffer `json:"offer"`
|
||||
}
|
||||
|
||||
var (
|
||||
@ -74,3 +74,26 @@ func LocalWS() nf.HandlerFunc {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func LocalOffer() nf.HandlerFunc {
|
||||
return func(c *nf.Ctx) error {
|
||||
type Req struct {
|
||||
Room string `json:"room"`
|
||||
Id string `json:"id"`
|
||||
Offer *controller.RoomOffer `json:"offer"`
|
||||
}
|
||||
|
||||
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.Offer(req.Room, req.Id, req.Offer)
|
||||
|
||||
return resp.Resp200(c, req.Offer)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user