mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
webrtc handle.
This commit is contained in:
parent
2068c0ee05
commit
60f459392a
@ -12,18 +12,26 @@ func (manager *WebRTCManagerCtx) handle(data []byte, session types.Session) erro
|
|||||||
// add session id to logger context
|
// add session id to logger context
|
||||||
logger := manager.logger.With().Str("session_id", session.ID()).Logger()
|
logger := manager.logger.With().Str("session_id", session.ID()).Logger()
|
||||||
|
|
||||||
buffer := bytes.NewBuffer(data)
|
//
|
||||||
header := &payload.Header{}
|
// parse header
|
||||||
hbytes := make([]byte, 3)
|
//
|
||||||
|
|
||||||
|
buffer := bytes.NewBuffer(data)
|
||||||
|
|
||||||
|
hbytes := make([]byte, 3)
|
||||||
if _, err := buffer.Read(hbytes); err != nil {
|
if _, err := buffer.Read(hbytes); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header := &payload.Header{}
|
||||||
if err := binary.Read(bytes.NewBuffer(hbytes), binary.BigEndian, header); err != nil {
|
if err := binary.Read(bytes.NewBuffer(hbytes), binary.BigEndian, header); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// parse body
|
||||||
|
//
|
||||||
|
|
||||||
buffer = bytes.NewBuffer(data)
|
buffer = bytes.NewBuffer(data)
|
||||||
|
|
||||||
switch header.Event {
|
switch header.Event {
|
||||||
|
Loading…
Reference in New Issue
Block a user