Documentation ¶
Index ¶
- Constants
- func WebsocketFileDescriptor(conn net.Conn) int
- type CORSOptions
- func (o *CORSOptions) CROSCheckAllowNext(writer http.ResponseWriter, request *http.Request) bool
- func (o *CORSOptions) Header(origin string) (headers map[string]string)
- func (o *CORSOptions) IsOriginAllowed(origin string) (allowed bool)
- func (o *CORSOptions) PreflightHeader(origin, rMethod, rHeaders string) (headers map[string]string)
- type EPool
- func (ePool *EPool) AddConnection(conn net.Conn) error
- func (ePool *EPool) GetConnection(connectionId int) (net.Conn, bool)
- func (ePool *EPool) GetConnectionIdSlice() []int
- func (ePool *EPool) GetConnectionMap() map[int]net.Conn
- func (ePool *EPool) GetConnectionSlice() []net.Conn
- func (ePool *EPool) ProcessWebSocketMessage(conn net.Conn, msg []byte, opCode byte) error
- func (ePool *EPool) RemoveConnection(conn net.Conn) error
- func (ePool *EPool) RunMainEventLoop()
- func (ePool *EPool) Setup()
- func (ePool *EPool) TotalActiveConnections() int
- func (ePool *EPool) Wait() ([]net.Conn, error)
- type EPoolRemoveConnectionHook
- type HTTPMiddlewareView
- type HTTPView
- type InterfaceMap
- type MiddlewareHandlerFunc
- type Pisig
- func (p *Pisig) AddMiddlewareView(middlewareView HTTPMiddlewareView)
- func (p *Pisig) AddOnlineUser(uniqueId string, groupId string, socketId int, data interface{}) bool
- func (p *Pisig) AddService(topicNameList []string, pisigService PisigService) bool
- func (p *Pisig) AddView(urlPattern string, view HTTPView)
- func (p *Pisig) AddWSConn(conn net.Conn) bool
- func (p *Pisig) AddWSConnection(conn net.Conn) bool
- func (p *Pisig) AddWebSocketConnection(conn net.Conn) bool
- func (p *Pisig) GetOnlineSocketIdList() []int
- func (p *Pisig) GetOnlineSocketList() []net.Conn
- func (p *Pisig) GetTopicListenerList(topicName string) []interface{}
- func (p *Pisig) GetTotalOnlineWSConnection() int
- func (p *Pisig) GetTotalOnlineWebSocketConnection() int
- func (p *Pisig) GetWSConn(sockedId int) net.Conn
- func (p *Pisig) GetWebSocketConnection(sockedId int) net.Conn
- func (p *Pisig) MiddlewareViewList() []HTTPMiddlewareView
- func (p *Pisig) PisigContext() *PisigContext
- func (p *Pisig) ProduceTopic(topic event.Topic)
- func (p *Pisig) Publish(topic event.Topic)
- func (p *Pisig) RunHTTPServer()
- func (p *Pisig) RunTopicDispatcher()
- func (p *Pisig) RunWebSocketServer(u *ws.Upgrader)
- func (p *Pisig) SendMessageToAll(message []byte)
- func (p *Pisig) SendMessageToGroup(groupId string, message []byte)
- func (p *Pisig) SendMessageToUser(uniqueId string, message []byte)
- func (p *Pisig) Subscribe(topicNameList []string, pisigService PisigService) bool
- type PisigContext
- func (pc *PisigContext) GetCORSOptions() *CORSOptions
- func (pc *PisigContext) GetOnlineUserStore() storage.OnlineUserStore
- func (pc *PisigContext) GetPisigMessage() message.PisigMessage
- func (pc *PisigContext) GetPisigServiceRegistry() *PisigServiceRegistry
- func (pc *PisigContext) GetPisigSettings() *settings.PisigSettings
- func (pc *PisigContext) GetPisigStore() *cache.PisigStore
- func (pc *PisigContext) ProduceTopic(topic event.Topic)
- func (pc *PisigContext) Publish(topic event.Topic)
- type PisigService
- type PisigServiceRegistry
- func (psr *PisigServiceRegistry) AddService(pisigService PisigService) (bool, error)
- func (psr *PisigServiceRegistry) AddTopicListener(topicName string, pisigService PisigService)
- func (psr *PisigServiceRegistry) GetAllAvailableServices() map[string][]string
- func (psr *PisigServiceRegistry) GetDefaultServiceMap() map[string]string
- func (psr *PisigServiceRegistry) GetDefaultServiceName(groupName string) (string, bool)
- func (psr *PisigServiceRegistry) GetGroupList() []string
- func (psr *PisigServiceRegistry) GetService(groupName string, serviceName string) (PisigService, error)
- func (psr *PisigServiceRegistry) GetServiceList() []string
- func (psr *PisigServiceRegistry) GetTopicListenerList(topicName string) []interface{}
- func (psr *PisigServiceRegistry) IsGroupExistsInList(groupName string) bool
- func (psr *PisigServiceRegistry) IsServiceExists(groupName string, serviceName string) bool
- func (psr *PisigServiceRegistry) IsServiceExistsInList(serviceName string) bool
- func (psr *PisigServiceRegistry) SetDefaultServiceName(groupName, serviceName string)
- type TopicDispatcher
- type TopicProcessor
Constants ¶
View Source
const ConstAppAuthors = "MD KAWSER MUNSHI"
View Source
const ConstAppDescription = "Pisig is a reusable high performance websocket focused web framework"
View Source
const ConstAppName = "pisig"
APP RELATED CONSTANTS
View Source
const ConstAppNameLong = "pisig service"
View Source
const ConstAppVersion = "v0.1.10"
Variables ¶
This section is empty.
Functions ¶
func WebsocketFileDescriptor ¶
Types ¶
type CORSOptions ¶
type CORSOptions struct { // If set, all origins are allowed. AllowAllOrigins bool // A list of allowed origins. Wild cards and FQDNs are supported. AllowOrigins []string // If set, allows to share auth credentials such as cookies. AllowCredentials bool // A list of allowed HTTP methods. AllowMethods []string // A list of allowed HTTP headers. AllowHeaders []string // A list of exposed HTTP headers. ExposeHeaders []string // Max age of the CORS headers. MaxAge time.Duration }
CORSOptions represents Access Control options.
func (*CORSOptions) CROSCheckAllowNext ¶
func (o *CORSOptions) CROSCheckAllowNext(writer http.ResponseWriter, request *http.Request) bool
CROSCheckAllowNext enables CORS for requests those match the provided options.
func (*CORSOptions) Header ¶
func (o *CORSOptions) Header(origin string) (headers map[string]string)
Header converts options into CORS headers.
func (*CORSOptions) IsOriginAllowed ¶
func (o *CORSOptions) IsOriginAllowed(origin string) (allowed bool)
IsOriginAllowed looks up if the origin matches one of the patterns generated from CORSOptions.AllowOrigins patterns.
func (*CORSOptions) PreflightHeader ¶
func (o *CORSOptions) PreflightHeader(origin, rMethod, rHeaders string) (headers map[string]string)
PreflightHeader converts options into CORS headers for a preflight response.
type EPool ¶
type EPool struct {
// contains filtered or unexported fields
}
func NewEPool ¶
func NewEPool(pisigContext *PisigContext, removeConnectionHook EPoolRemoveConnectionHook, ) (*EPool, error)
func (*EPool) GetConnectionIdSlice ¶
func (*EPool) GetConnectionSlice ¶
func (*EPool) ProcessWebSocketMessage ¶
func (*EPool) RunMainEventLoop ¶
func (ePool *EPool) RunMainEventLoop()
func (*EPool) TotalActiveConnections ¶
type EPoolRemoveConnectionHook ¶
type EPoolProcessMessageHook func(conn net.Conn, msg []byte, opCode byte) error
type HTTPMiddlewareView ¶
type HTTPMiddlewareView interface {
ProcessAllowNext(pisig *Pisig) MiddlewareHandlerFunc
}
type HTTPView ¶
type HTTPView interface {
Process(pisig *Pisig) http.HandlerFunc
}
type InterfaceMap ¶
type InterfaceMap map[string]interface{}
type MiddlewareHandlerFunc ¶
type MiddlewareHandlerFunc func(http.ResponseWriter, *http.Request) bool
type Pisig ¶
type Pisig struct {
// contains filtered or unexported fields
}
func NewPisigSimple ¶
func NewPisigSimple(corsOptions *CORSOptions, pisigSettings *settings.PisigSettings, pisigResponse message.PisigMessage, onlineUserStore storage.OnlineUserStore) *Pisig
func (*Pisig) AddMiddlewareView ¶
func (p *Pisig) AddMiddlewareView(middlewareView HTTPMiddlewareView)
func (*Pisig) AddOnlineUser ¶
func (*Pisig) AddService ¶
func (p *Pisig) AddService(topicNameList []string, pisigService PisigService) bool
func (*Pisig) GetOnlineSocketIdList ¶
func (*Pisig) GetOnlineSocketList ¶
func (*Pisig) GetTopicListenerList ¶
func (*Pisig) GetTotalOnlineWSConnection ¶
func (*Pisig) GetTotalOnlineWebSocketConnection ¶
func (*Pisig) GetWebSocketConnection ¶ added in v0.1.6
func (*Pisig) MiddlewareViewList ¶
func (p *Pisig) MiddlewareViewList() []HTTPMiddlewareView
func (*Pisig) PisigContext ¶
func (p *Pisig) PisigContext() *PisigContext
func (*Pisig) ProduceTopic ¶
func (*Pisig) RunHTTPServer ¶
func (p *Pisig) RunHTTPServer()
func (*Pisig) RunTopicDispatcher ¶
func (p *Pisig) RunTopicDispatcher()
func (*Pisig) RunWebSocketServer ¶ added in v0.1.5
func (*Pisig) SendMessageToAll ¶
Send message to all active websocket connection
func (*Pisig) SendMessageToGroup ¶
Send message to the specific group of active websocket connection
func (*Pisig) SendMessageToUser ¶
Send message to the specific user active websocket connection
type PisigContext ¶
type PisigContext struct { PisigStore *cache.PisigStore PisigServiceRegistry *PisigServiceRegistry CORSOptions *CORSOptions PisigMessage message.PisigMessage PisigSettings *settings.PisigSettings OnlineUserStore storage.OnlineUserStore TopicQueue event.TopicQueue //will be initialized during pisig instance creation }
func (*PisigContext) GetCORSOptions ¶
func (pc *PisigContext) GetCORSOptions() *CORSOptions
func (*PisigContext) GetOnlineUserStore ¶
func (pc *PisigContext) GetOnlineUserStore() storage.OnlineUserStore
func (*PisigContext) GetPisigMessage ¶
func (pc *PisigContext) GetPisigMessage() message.PisigMessage
func (*PisigContext) GetPisigServiceRegistry ¶
func (pc *PisigContext) GetPisigServiceRegistry() *PisigServiceRegistry
func (*PisigContext) GetPisigSettings ¶
func (pc *PisigContext) GetPisigSettings() *settings.PisigSettings
func (*PisigContext) GetPisigStore ¶
func (pc *PisigContext) GetPisigStore() *cache.PisigStore
func (*PisigContext) ProduceTopic ¶
func (pc *PisigContext) ProduceTopic(topic event.Topic)
func (*PisigContext) Publish ¶ added in v0.1.2
func (pc *PisigContext) Publish(topic event.Topic)
type PisigService ¶
type PisigServiceRegistry ¶
type PisigServiceRegistry struct {
// contains filtered or unexported fields
}
func NewPisigServiceRegistry ¶
func NewPisigServiceRegistry() *PisigServiceRegistry
func (*PisigServiceRegistry) AddService ¶
func (psr *PisigServiceRegistry) AddService(pisigService PisigService) (bool, error)
func (*PisigServiceRegistry) AddTopicListener ¶
func (psr *PisigServiceRegistry) AddTopicListener(topicName string, pisigService PisigService)
func (*PisigServiceRegistry) GetAllAvailableServices ¶ added in v0.1.9
func (psr *PisigServiceRegistry) GetAllAvailableServices() map[string][]string
func (*PisigServiceRegistry) GetDefaultServiceMap ¶ added in v0.1.10
func (psr *PisigServiceRegistry) GetDefaultServiceMap() map[string]string
func (*PisigServiceRegistry) GetDefaultServiceName ¶ added in v0.1.5
func (psr *PisigServiceRegistry) GetDefaultServiceName(groupName string) (string, bool)
func (*PisigServiceRegistry) GetGroupList ¶
func (psr *PisigServiceRegistry) GetGroupList() []string
func (*PisigServiceRegistry) GetService ¶
func (psr *PisigServiceRegistry) GetService(groupName string, serviceName string) (PisigService, error)
func (*PisigServiceRegistry) GetServiceList ¶
func (psr *PisigServiceRegistry) GetServiceList() []string
func (*PisigServiceRegistry) GetTopicListenerList ¶
func (psr *PisigServiceRegistry) GetTopicListenerList(topicName string) []interface{}
func (*PisigServiceRegistry) IsGroupExistsInList ¶
func (psr *PisigServiceRegistry) IsGroupExistsInList(groupName string) bool
func (*PisigServiceRegistry) IsServiceExists ¶
func (psr *PisigServiceRegistry) IsServiceExists(groupName string, serviceName string) bool
func (*PisigServiceRegistry) IsServiceExistsInList ¶
func (psr *PisigServiceRegistry) IsServiceExistsInList(serviceName string) bool
func (*PisigServiceRegistry) SetDefaultServiceName ¶ added in v0.1.5
func (psr *PisigServiceRegistry) SetDefaultServiceName(groupName, serviceName string)
type TopicDispatcher ¶
type TopicDispatcher struct { Pisig *Pisig TopicQueuePoolSize int TopicProducerQueue event.TopicQueue TopicQueuePool event.TopicQueuePool }
func NewTopicDispatcher ¶
func NewTopicDispatcher(pisig *Pisig, topicQueue event.TopicQueue) *TopicDispatcher
func (*TopicDispatcher) Run ¶
func (td *TopicDispatcher) Run()
type TopicProcessor ¶
type TopicProcessor struct { Pisig *Pisig TopicQueue event.TopicQueue TopicQueuePool event.TopicQueuePool // contains filtered or unexported fields }
func NewTopicProcessor ¶
func NewTopicProcessor(pisig *Pisig, topicQueuePool event.TopicQueuePool) TopicProcessor
func (TopicProcessor) Start ¶
func (tp TopicProcessor) Start()
Click to show internal directories.
Click to hide internal directories.