server

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr string
}

type ConnectionHandler

type ConnectionHandler func(Socket)

type Server

type Server struct {
	Config Config
	Events map[string]ConnectionHandler

	RandFunc func() int
	// contains filtered or unexported fields
}

the server struct

func Create

func Create(config Config) Server

func (*Server) Emit

func (s *Server) Emit(eventName string, data []byte)

func (*Server) Listen

func (s *Server) Listen() error

func (*Server) On

func (s *Server) On(eventName string, cb ConnectionHandler)

func (*Server) StopListening

func (s *Server) StopListening()

func (*Server) UserDisconnect

func (s *Server) UserDisconnect(user Socket)

this function should be called after disconnecting a user

type Socket

type Socket struct {
	Events map[string]event.Handler
	Id     int
	// contains filtered or unexported fields
}

func (*Socket) Emit

func (s *Socket) Emit(eventName string, data []byte)

func (*Socket) On

func (s *Socket) On(eventName string, cb event.Handler)

Jump to

Keyboard shortcuts

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