controllers

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionsHandler

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

ActionsHandler used to mange callbacks for controllers

func (*ActionsHandler) AddAction

func (handler *ActionsHandler) AddAction(actionName string, action func(*Connection) (interface{}, error))

AddAction used to add action

type CallbacksHandler

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

CallbacksHandler used to mange callbacks for controllers

func (*CallbacksHandler) AddBeforeAction

func (handler *CallbacksHandler) AddBeforeAction(beforeAction func(string, *Connection) error)

AddBeforeAction used to add before action callback

func (*CallbacksHandler) CallBeforeActions

func (handler *CallbacksHandler) CallBeforeActions(action string, connection *Connection) error

CallBeforeActions used to call before actions callback

type Connection

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

Connection used to represent connection with properties and params

func MakeConnection

func MakeConnection(conn socketio.Conn, params map[string]interface{}) *Connection

MakeConnection use to instantiate connection instance

func (*Connection) Join

func (connection *Connection) Join(room string)

Join used to join socketio room

func (*Connection) Params

func (connection *Connection) Params(key string) interface{}

Params used to retrieve params value

func (*Connection) ParamsInt added in v0.0.17

func (connection *Connection) ParamsInt(key string, fallback int) int

ParamsInt used to retrieve params value in int

func (*Connection) ParamsStr added in v0.0.17

func (connection *Connection) ParamsStr(key string) string

ParamsStr used to retrieve params value in string

func (*Connection) ParamsWithFallback

func (connection *Connection) ParamsWithFallback(key string, fallback interface{}) interface{}

ParamsWithFallback used to retrieve params value with a fallback

func (*Connection) Property

func (connection *Connection) Property(key string) interface{}

Property used to retrieve context property value

func (*Connection) PropertyWithFallback

func (connection *Connection) PropertyWithFallback(key string, fallback interface{}) interface{}

PropertyWithFallback used to retrieve context property value with a fallback

func (*Connection) SetProperty

func (connection *Connection) SetProperty(key string, value interface{})

SetProperty used to set property that can used across the context

type Controller

type Controller interface {
	AddBeforeActions(*CallbacksHandler)
	AddActions(*ActionsHandler)
}

Controller used to represent base classes for all controllers

type ControllerHandler

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

ControllerHandler used to handle controller

func MakeControllerHandler

func MakeControllerHandler(server *socketio.Server, nsp string, controller Controller) *ControllerHandler

MakeControllerHandler used to instantiate controller handler

type Errors

type Errors struct {
	Messages string
}

type NetworkError

type NetworkError struct {
	Status int
	Error  string
}

type SocketEvent

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

SocketEvent used as medium of communication

func MakeSocketEvent

func MakeSocketEvent(nsp string, room string, eventName string, view interface{}, parameters map[string]interface{}) *SocketEvent

MakeSocketEvent used to instantiate an socket event

func (*SocketEvent) Broadcast

func (socketEvent *SocketEvent) Broadcast(server *socketio.Server)

Broadcast used to broadcast event

Jump to

Keyboard shortcuts

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