controllers

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v0.0.21

type Action func(*Context) (interface{}, error)

Action is handler for func(*Connection) (interface{}, error)

type ActionsHandler

type ActionsHandler struct {
	// contains filtered or unexported fields
}

ActionsHandler used to mange callbacks for controllers

func (*ActionsHandler) RegisterAction added in v0.0.21

func (handler *ActionsHandler) RegisterAction(actionName string, action Action)

RegisterAction used to register action

func (*ActionsHandler) RegisterConnectedAction added in v0.0.37

func (handler *ActionsHandler) RegisterConnectedAction(action Action)

RegisterConnectedAction used to register connected action

func (*ActionsHandler) RegisterDisconnectedAction added in v0.0.37

func (handler *ActionsHandler) RegisterDisconnectedAction(action Action)

RegisterDisconnectedAction used to register disconnected action

func (*ActionsHandler) RegisterErrorAction added in v0.0.37

func (handler *ActionsHandler) RegisterErrorAction(action Action)

RegisterErrorAction used to register error action

type Context added in v0.0.21

type Context struct {
	// contains filtered or unexported fields
}

Context used to represent context with properties and params

func (*Context) Join added in v0.0.21

func (context *Context) Join(room string)

Join used to join socketio room

func (*Context) Leave added in v0.0.21

func (context *Context) Leave(room string)

Leave used to leave socketio room

func (*Context) Params added in v0.0.21

func (context *Context) Params(key string) interface{}

Params used to retrieve params value

func (*Context) ParamsInt added in v0.0.21

func (context *Context) ParamsInt(key string, fallback int) int

ParamsInt used to retrieve params value in int

func (*Context) ParamsStr added in v0.0.21

func (context *Context) ParamsStr(key string) string

ParamsStr used to retrieve params value in string

func (*Context) ParamsWithFallback added in v0.0.21

func (context *Context) ParamsWithFallback(key string, fallback interface{}) interface{}

ParamsWithFallback used to retrieve params value with a fallback

func (*Context) Property added in v0.0.21

func (context *Context) Property(key string) interface{}

Property used to retrieve context property value

func (*Context) PropertyWithFallback added in v0.0.21

func (context *Context) PropertyWithFallback(key string, fallback interface{}) interface{}

PropertyWithFallback used to retrieve context property value with a fallback

func (*Context) Rooms added in v0.0.21

func (context *Context) Rooms() []string

Rooms used to retrieve all connection's rooms

func (*Context) SetProperty added in v0.0.21

func (context *Context) SetProperty(key string, value interface{})

SetProperty used to set property that can used across the context

func (*Context) SingleJoin added in v0.0.21

func (context *Context) SingleJoin(room string)

SingleJoin used to join socketio room while leaving other joined rooms

type Controllable added in v0.0.21

type Controllable interface {
	RegisterHooksAndActions(*HooksHandler, *ActionsHandler)
}

Controllable is the interface for all controllers implementing RegisterBeforeHooks and RegisterActions

type ControllerHandler

type ControllerHandler struct {
	// contains filtered or unexported fields
}

ControllerHandler used to handle controller

type ErrorsView added in v0.0.21

type ErrorsView struct {
	Messages string
}

ErrorsView is view template for controller errors

type Event added in v0.0.21

type Event struct {
	// contains filtered or unexported fields
}

Event used as medium of communication

func (*Event) Broadcast added in v0.0.21

func (event *Event) Broadcast(server *socketio.Server)

Broadcast used to broadcast event

type Hook added in v0.0.21

type Hook func(string, *Context) error

Hook is alias for Hook

type HooksHandler added in v0.0.21

type HooksHandler struct {
	// contains filtered or unexported fields
}

HooksHandler used to mange callbacks for controllers

func (*HooksHandler) RegisterBeforeHook added in v0.0.27

func (handler *HooksHandler) RegisterBeforeHook(beforeHook Hook)

RegisterBeforeHook used to add before hook

type Manager added in v0.0.21

type Manager struct {
	// contains filtered or unexported fields
}

Manager is singleton manager for controller module

func (*Manager) BroadcastEvent added in v0.0.21

func (manager *Manager) BroadcastEvent(nsp string, room string, eventName string, view interface{}, parameters helpers.H)

BroadcastEvent used to broadcast event

func (*Manager) RegisterController added in v0.0.21

func (manager *Manager) RegisterController(nsp string, controllable Controllable)

RegisterController used to register controller

func (*Manager) Serve added in v0.0.21

func (manager *Manager) Serve(port string, httpHandler func())

Serve used to serve

func (*Manager) Setup added in v0.0.21

func (manager *Manager) Setup()

Setup used to setup cotroller manager

type NetworkError

type NetworkError struct {
	Status int
	Error  string
}

NetworkError encapsulates network error with status code and error message

Jump to

Keyboard shortcuts

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