package mtproto
import (
"context"
"github.com/go-faster/errors"
"github.com/gotd/log"
"github.com/gotd/td/bin"
"github.com/gotd/td/mt"
"github.com/gotd/td/proto"
)
func (c *Conn ) handleMessage (msgID int64 , b *bin .Buffer ) error {
id , err := b .PeekID ()
if err != nil {
return errors .Wrap (err , "peek message type" )
}
c .logWithBuffer (b ).Debug (context .Background (), "Handle message" , log .Int64 ("msg_id" , msgID ))
switch id {
case mt .NewSessionCreatedTypeID :
return c .handleSessionCreated (b )
case mt .BadMsgNotificationTypeID , mt .BadServerSaltTypeID :
return c .handleBadMsg (b )
case mt .FutureSaltsTypeID :
return c .handleFutureSalts (b )
case proto .MessageContainerTypeID :
return c .handleContainer (msgID , b )
case proto .ResultTypeID :
return c .handleResult (b )
case mt .PongTypeID :
return c .handlePong (b )
case mt .MsgsAckTypeID :
return c .handleAck (b )
case proto .GZIPTypeID :
return c .handleGZIP (msgID , b )
case mt .MsgDetailedInfoTypeID ,
mt .MsgNewDetailedInfoTypeID :
return nil
default :
return c .handler .OnMessage (b )
}
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .