Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastPeer ¶ added in v0.5.0
func NewBroadcastPeer ¶ added in v0.5.0
func NewBroadcastPeer(gs rua.GameServer) *BroadcastPeer
Create a new BroadcastPeer. By default, the broadcast peer will broadcast message in parallel to all other peers except it self. You can use `WithSelector` to select broadcast targets. The BroadcastPeer will never write message to itself to avoid recursive call.
func (*BroadcastPeer) WithSelector ¶ added in v0.5.0
func (bp *BroadcastPeer) WithSelector(f func(p rua.Peer) bool) *BroadcastPeer
If the selector returns true, the target peer will be notified.
func (*BroadcastPeer) WithSyncWrite ¶ added in v0.5.0
func (bp *BroadcastPeer) WithSyncWrite(sync bool) *BroadcastPeer
type NetPeer ¶
type NetPeer struct { *peer.BufferPeer // contains filtered or unexported fields }
func NewNetPeer ¶
func NewNetPeer(conn net.Conn, gs rua.GameServer) *NetPeer
Create a peer with a connection of `net.Conn`. If `timeout` == 0 (in ms), there is no timeout.
func (*NetPeer) WithBufSize ¶
func (*NetPeer) WithReadTimeout ¶
func (*NetPeer) WithTimeout ¶
Set the readTimeout and writeTimeout to the specified ms.
func (*NetPeer) WithWriteTimeout ¶
Click to show internal directories.
Click to hide internal directories.