Documentation ¶
Index ¶
- Variables
- func HandlePingPong(s *Socket, c *Context, interval, timeout time.Duration, message []byte)
- type Actor
- type ActorMap
- type Config
- type Context
- type Event
- type Message
- type Socket
- func (s *Socket) Callback(cb func(c *Context) error)
- func (s *Socket) Close(a *Actor) (err error)
- func (s *Socket) CloseGoingAway(a *Actor, message string) (err error)
- func (s *Socket) CloseInternalServerError(a *Actor, message string) (err error)
- func (s *Socket) CloseInvalidFramePayloadData(a *Actor, message string) (err error)
- func (s *Socket) CloseMandatoryExt(a *Actor, message string) (err error)
- func (s *Socket) CloseMessageTooBig(a *Actor, message string) (err error)
- func (s *Socket) CloseNoMeaningYet(a *Actor, message string) (err error)
- func (s *Socket) CloseNormalClosure(a *Actor, message string) (err error)
- func (s *Socket) ClosePolicyViolation(a *Actor, message string) (err error)
- func (s *Socket) CloseProtocolError(a *Actor, message string) (err error)
- func (s *Socket) CloseTLSHandshake(a *Actor, message string) (err error)
- func (s *Socket) CloseUnsupportedData(a *Actor, message string) (err error)
- func (s *Socket) IterateEachActor(cb func(*Actor))
- func (s *Socket) Listen(port int) error
- func (s *Socket) SendByteTo(id string, data []byte) error
- func (s *Socket) SendTextTo(id, message string) error
- type TypeCode
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ( PING = []byte("PING") PONG = []byte("PONG") CLOSE = []byte("CLOSE") )
this variable used to check actor connection wheter still connected or not
var DefaultConfig = Config{ Timeout: time.Second * 4, UIDLength: 16, WorkerPool: 100, BufferedTask: 1024, // contains filtered or unexported fields }
DefaultConfig setting up for default connection config
Functions ¶
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
Actor struct containing information of actor Actor can be said as an connected client
func (*Actor) PONG ¶
func (actor *Actor) PONG()
PONG function to signaling channel to ping back to the client
type Config ¶
type Config struct { Timeout time.Duration UIDLength int WorkerPool int BufferedTask int // contains filtered or unexported fields }
Config storing config for incoming message callback
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context stored info from client
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event describe of incoming event type
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message stored data of incoming signal from client
type Socket ¶
type Socket struct {
// contains filtered or unexported fields
}
Socket struct for storing connection information
func CreateWebSocket ¶
func CreateWebSocket() *Socket
CreateWebSocket constructor to create socket connection
func (*Socket) CloseGoingAway ¶
CloseGoingAway is used to close actor connection with defined status
func (*Socket) CloseInternalServerError ¶
CloseInternalServerError is used to close actor connection with defined status
func (*Socket) CloseInvalidFramePayloadData ¶
CloseInvalidFramePayloadData is used to close actor connection with defined status
func (*Socket) CloseMandatoryExt ¶
CloseMandatoryExt is used to close actor connection with defined status
func (*Socket) CloseMessageTooBig ¶
CloseMessageTooBig is used to close actor connection with defined status
func (*Socket) CloseNoMeaningYet ¶
CloseNoMeaningYet is used to close actor connection with defined status
func (*Socket) CloseNormalClosure ¶
CloseNormalClosure is used to close actor connection with defined status
func (*Socket) ClosePolicyViolation ¶
ClosePolicyViolation is used to close actor connection with defined status
func (*Socket) CloseProtocolError ¶
CloseProtocolError is used to close actor connection with defined status
func (*Socket) CloseTLSHandshake ¶
CloseTLSHandshake is used to close actor connection with defined status
func (*Socket) CloseUnsupportedData ¶
CloseUnsupportedData is used to close actor connection with defined status
func (*Socket) IterateEachActor ¶
IterateEachActor this function enable you to send text to every client but by criteria, return true if then this client will receive the message
func (*Socket) SendByteTo ¶
SendByteTo function that can enable to send message to other connected client
func (*Socket) SendTextTo ¶
SendTextTo function that can enable to send message to other connected client
type TypeCode ¶
type TypeCode byte
TypeCode type alias for byte enum
type Worker ¶
type Worker interface { // Callback can only be called when initializing the worker // and should not be nil // this function will responsible to what you want to do // with passed data from worker pool Callback(func(interface{})) // CallbackOnError same as Callback but with purpose to // this function set what you want to do when data/task // is not submited or not running properly CallbackOnError(func(interface{})) // Submit this function supposed to handle submit data // parameter can be list Submit(...interface{}) }
Worker this interface defined Worker behaviour so, we can use many backend workers API
func CreateWorkerPond ¶
CreateWorkerPond constructor with default config pond worker pool