app

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomLog customLog
View Source
var WebSocketCallbacks sync.Map

Functions

func AddCancelChannel

func AddCancelChannel() (key string, c chan int)

func BroadcastWebSocketData

func BroadcastWebSocketData(data []byte)

func BroadcastWebSocketJSON

func BroadcastWebSocketJSON(v interface{})

func CancelChannel

func CancelChannel(key string)

func CloseAllSockets

func CloseAllSockets()

func GetAllWebSocketMeta

func GetAllWebSocketMeta() (items *sync.Map)

func Initialize

func Initialize(path string, config string) (err error)

func InitializeLite

func InitializeLite() (err error)

func PublishWebSocketJSON

func PublishWebSocketJSON(key string, v interface{})

func RandomString

func RandomString(strlen int) string

func RegisterWebSocketDataCallback

func RegisterWebSocketDataCallback(callback WebSocketCallback)

func RemoveWebSocketMeta

func RemoveWebSocketMeta(id string)

func ReplyToWebSocket

func ReplyToWebSocket(conn *WebSocketConnection, data []byte)

func ReplyToWebSocketJSON

func ReplyToWebSocketJSON(conn *WebSocketConnection, v interface{})

func ReplyToWebSocketPubSub

func ReplyToWebSocketPubSub(conn *WebSocketConnection, key string, v interface{})

func Run

func Run()

func RunLite

func RunLite(port int)

func SetWebSocketMeta

func SetWebSocketMeta(id string, info *WebSocketConnectionMeta)

func SetWebSocketTimeout

func SetWebSocketTimeout(timeout int)

Types

type ConcurrentWebSocketCallbackItem

type ConcurrentWebSocketCallbackItem struct {
	Index    int
	Callback WebSocketCallback
}

type ConcurrentWebSocketConnectionItem

type ConcurrentWebSocketConnectionItem struct {
	Index int
	Conn  *WebSocketConnection
}

type GinContextSync

type GinContextSync struct {
	sync.RWMutex
	Initialized atomicTypes.AtomicBool
	Context     *gin.Context
}

type WebSocketCallback

type WebSocketCallback func(conn *WebSocketConnection, c *gin.Context, messageType int, id string, data []byte)

type WebSocketCallbackSync

type WebSocketCallbackSync struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*WebSocketCallbackSync) Append

func (self *WebSocketCallbackSync) Append(item WebSocketCallback)

func (*WebSocketCallbackSync) Iter

type WebSocketConnection

type WebSocketConnection struct {
	sync.RWMutex
	Id                   string
	Connection           *websocket.Conn
	Req                  *http.Request
	Context              interface{}
	ContextString        string
	ContextType          string
	ContextLock          sync.RWMutex
	WriteLock            sync.RWMutex
	LastResponseTime     time.Time
	LastResponseTimeLock sync.RWMutex

	GinContextSync GinContextSync
}

type WebSocketConnectionCollection

type WebSocketConnectionCollection struct {
	sync.RWMutex
	Connections []*WebSocketConnection
}
var WebSocketConnections WebSocketConnectionCollection

func (*WebSocketConnectionCollection) Append

func (*WebSocketConnectionCollection) Iter

type WebSocketConnectionMeta

type WebSocketConnectionMeta struct {
	Conn             *WebSocketConnection
	Context          interface{}
	ContextString    string
	ContextType      string
	LastResponseTime atomicTypes.AtomicTime
	TimeoutOverride  atomicTypes.AtomicInt
}

func GetWebSocketMeta

func GetWebSocketMeta(id string) (info *WebSocketConnectionMeta, ok bool)

func (*WebSocketConnectionMeta) GetConnection

func (obj *WebSocketConnectionMeta) GetConnection() (conn *WebSocketConnection)

func (*WebSocketConnectionMeta) SetTimeoutOverride

func (obj *WebSocketConnectionMeta) SetTimeoutOverride(timeout int)

type WebSocketPubSubPayload

type WebSocketPubSubPayload struct {
	Key     string      `json:"Key"`
	Content interface{} `json:"Content"`
}

type WebSocketRemoval

type WebSocketRemoval func(info WebSocketConnectionMeta)
var WebSocketRemovalCallback WebSocketRemoval

Directories

Path Synopsis
api provides an API router and controller Registry to route controller api's.
api provides an API router and controller Registry to route controller api's.

Jump to

Keyboard shortcuts

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