Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Connection
- type HasCallId
- type Map
- func (m *Map[K, V]) Find(key K) (v V, ok bool)
- func (m *Map[K, V]) FindBy(fn func(v V) bool) (v V, ok bool)
- func (m *Map[K, V]) ForEach(fn func(v V))
- func (m *Map[K, _]) Has(key K) bool
- func (m *Map[_, _]) Len() int
- func (m *Map[K, V]) Pop(key K) V
- func (m *Map[K, V]) Put(key K, v V)
- func (m *Map[K, _]) Remove(key K)
- type NetClient
- type NetMap
- type Packet
- type Packet2
- type RPC
- type Server
- type SocketClient
- func (c *SocketClient[_, _, _, _]) Disconnect()
- func (c *SocketClient[_, _, _, _]) Id() Uid
- func (c *SocketClient[T, P, X, P2]) Notify(t T, data any)
- func (c *SocketClient[T, P, _, _]) ProcessPackets(fn func(in P) error) chan struct{}
- func (c *SocketClient[_, P, X, P2]) Route(in P, out P2)
- func (c *SocketClient[T, P, X, P2]) Send(t T, data any) ([]byte, error)
- func (c *SocketClient[_, _, _, _]) String() string
- type Transport
- type Uid
- type Writer
Constants ¶
View Source
const DefaultCallTimeout = 7 * time.Second
Variables ¶
View Source
var NilUid = Uid{xid.NilID()}
Functions ¶
This section is empty.
Types ¶
type Connection ¶ added in v3.0.5
type Connection struct {
// contains filtered or unexported fields
}
func (Connection) IsServer ¶ added in v3.0.5
func (c Connection) IsServer() bool
type Map ¶ added in v3.0.5
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map defines a concurrent-safe map structure. Keep in mind that the underlying map structure will grow indefinitely.
func (*Map[K, V]) Find ¶ added in v3.0.5
Find returns the first value found and a boolean flag if its found or not.
func (*Map[K, V]) FindBy ¶ added in v3.0.5
FindBy searches the first key-value with the provided predicate function.
type NetMap ¶
func (*NetMap[T]) RemoveDisconnect ¶ added in v3.0.5
func (m *NetMap[T]) RemoveDisconnect(client T)
type RPC ¶ added in v3.0.5
type RPC[T ~uint8, P Packet[T]] struct { CallTimeout time.Duration Handler func(P) Transport Transport // contains filtered or unexported fields }
type Server ¶ added in v3.0.5
func (*Server) Connect ¶ added in v3.0.5
func (s *Server) Connect(w http.ResponseWriter, r *http.Request) (*Connection, error)
type SocketClient ¶
type SocketClient[T ~uint8, P Packet[T], X any, P2 Packet2[X]] struct { // contains filtered or unexported fields }
func NewConnection ¶ added in v3.0.5
func NewConnection[T ~uint8, P Packet[T], X any, P2 Packet2[X]](conn *Connection, id Uid, log *logger.Logger) *SocketClient[T, P, X, P2]
func (*SocketClient[_, _, _, _]) Disconnect ¶ added in v3.0.5
func (c *SocketClient[_, _, _, _]) Disconnect()
func (*SocketClient[_, _, _, _]) Id ¶
func (c *SocketClient[_, _, _, _]) Id() Uid
func (*SocketClient[T, P, X, P2]) Notify ¶
func (c *SocketClient[T, P, X, P2]) Notify(t T, data any)
Notify just sends a message and goes further.
func (*SocketClient[T, P, _, _]) ProcessPackets ¶ added in v3.0.5
func (c *SocketClient[T, P, _, _]) ProcessPackets(fn func(in P) error) chan struct{}
func (*SocketClient[_, P, X, P2]) Route ¶
func (c *SocketClient[_, P, X, P2]) Route(in P, out P2)
func (*SocketClient[T, P, X, P2]) Send ¶
func (c *SocketClient[T, P, X, P2]) Send(t T, data any) ([]byte, error)
Send makes a blocking call.
func (*SocketClient[_, _, _, _]) String ¶
func (c *SocketClient[_, _, _, _]) String() string
type Uid ¶ added in v3.0.5
func UidFromString ¶ added in v3.0.5
Click to show internal directories.
Click to hide internal directories.