Send event
This commit is contained in:
@@ -202,7 +202,18 @@ func (c *Conn) sendRegisteredPacket(packet proto_base.EncodeDecodeAble) (err err
|
|||||||
return c.SendRaw(packetBuff.Bytes())
|
return c.SendRaw(packetBuff.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Send struct {
|
||||||
|
Packet proto_base.EncodeDecodeAble
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Conn) Send(packet proto_base.EncodeDecodeAble) (err error) {
|
func (c *Conn) Send(packet proto_base.EncodeDecodeAble) (err error) {
|
||||||
|
err = c.Fire(Send{Packet: packet})
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if c.W == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
switch packet := packet.(type) {
|
switch packet := packet.(type) {
|
||||||
case *UnCodablePacket:
|
case *UnCodablePacket:
|
||||||
err = c.SendRaw(packet.Data)
|
err = c.SendRaw(packet.Data)
|
||||||
|
|||||||
Reference in New Issue
Block a user