sckio

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name string) *sckServer

func NewAppSocket added in v1.0.1

func NewAppSocket(s Socket, user sdkcm.Requester) *appSocket

Types

type AppSocket

type AppSocket interface {
	CurrentUser() sdkcm.Requester
	Socket
}

type Config

type Config struct {
	Name          string
	MaxConnection int
}

type ObserverProvider

type ObserverProvider interface {
	AddObservers(server *socketio.Server, sc goservice.ServiceContext, l logger.Logger) func(socketio.Conn) error
}

type Socket

type Socket interface {
	ID() string
	Close() error
	URL() url.URL
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	RemoteHeader() http.Header

	Context() interface{}
	SetContext(v interface{})
	Namespace() string
	Emit(msg string, v ...interface{})

	Join(room string)
	Leave(room string)
	LeaveAll()
	Rooms() []string
}

type SocketServer added in v1.0.1

type SocketServer interface {
	UserSockets(userId int) []AppSocket
	EmitToRoom(room string, key string, data interface{}) error
	EmitToUser(userId int, key string, data interface{}) error
	StartRealtimeServer(engine *gin.Engine, sc goservice.ServiceContext, op ObserverProvider)
	GetSocketServer() *socketio.Server
	SaveAppSocket(userId int, appSck AppSocket)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL