message

package
v0.0.0-...-ccdab22 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

type Controller

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

func NewController

func NewController(r *rediscli.Redis) *Controller

func (Controller) ChannelJoin

func (p Controller) ChannelJoin(sessionUUID string, conn net.Conn, op ws.OpCode, write Write, message *Message) (*rediscli.ChannelPubSub, IError)

func (Controller) ChannelLeave

func (p Controller) ChannelLeave(sessionUUID string, writer Write, message *Message) IError

func (Controller) ChannelMessage

func (p Controller) ChannelMessage(sessionUUID string, conn net.Conn, op ws.OpCode, writer Write, message *Message) IError

func (Controller) Error

func (p Controller) Error(code uint32, err error, sessionUID string, payload interface{}) *Message

func (Controller) Ready

func (p Controller) Ready(sessionUUID string) *Message

func (Controller) SignIn

func (p Controller) SignIn(sessionUUID string, conn net.Conn, op ws.OpCode, write Write, message *Message) IError

func (Controller) SignOut

func (p Controller) SignOut(sessionUUID string, conn net.Conn, op ws.OpCode, write Write, message *Message) IError

func (Controller) SignUp

func (p Controller) SignUp(sessionUUID string, conn net.Conn, op ws.OpCode, write Write, message *Message) IError

func (Controller) SysChannelJoin

func (p Controller) SysChannelJoin(user *rediscli.User, recipientsUUID []string) *Message

func (Controller) SysChannelLeave

func (p Controller) SysChannelLeave(user *rediscli.User, recipientsUUID []string) *Message

func (Controller) SysSignIn

func (p Controller) SysSignIn(user *rediscli.User) *Message

func (*Controller) Users

func (p *Controller) Users(sessionUUID string, conn net.Conn, op ws.OpCode, write Write) IError

type DataAuthorized

type DataAuthorized struct {
	UserUUID  string `json:"userUUID"`
	AccessKey string `json:"accessKey"`
}

type DataChannelJoin

type DataChannelJoin struct {
	RecipientUUID string              `json:"recipientUUID,omitempty"`
	Messages      []*rediscli.Message `json:"messages,omitempty"`
	Users         []*rediscli.User    `json:"users,omitempty"`
}

type DataChannelLeave

type DataChannelLeave struct {
	SenderUUID    string `json:"senderUUID"`
	RecipientUUID string `json:"recipientUUID"`
}

type DataChannelMessage

type DataChannelMessage struct {
	UUID          string         `json:"UUID"`
	Sender        *rediscli.User `json:"Sender,omitempty"`
	SenderUUID    string         `json:"SenderUUID"`
	Recipient     *rediscli.User `json:"Recipient,omitempty"`
	RecipientUUID string         `json:"RecipientUUID"`
	Message       string         `json:"Message"`
	CreatedAt     time.Time      `json:"CreatedAt"`
}

type DataError

type DataError struct {
	Code    uint32      `json:"code"`
	Error   string      `json:"error"`
	Payload interface{} `json:"payload"`
}

type DataReady

type DataReady struct {
	SessionUUID string `json:"sessionUUID"`
}

type DataSignIn

type DataSignIn struct {
	UUID     string `json:"uuid"`
	Username string `json:"username"`
	Password string `json:"password,omitempty"`
}

type DataSignOut

type DataSignOut struct {
	UUID string `json:"uuid"`
}

type DataSignUp

type DataSignUp struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type DataSys

type DataSys struct {
	Type         DataType          `json:"type"`
	Message      string            `json:"message,omitempty"`
	SignIn       *DataSignIn       `json:"signIn,omitempty"`
	ChannelJoin  *DataChannelJoin  `json:"channelJoin,omitempty"`
	ChannelLeave *DataChannelLeave `json:"channelLeave,omitempty"`
}

type DataType

type DataType string
const (
	DataTypeSys             DataType = "sys"
	DataTypeReady           DataType = "ready"
	DataTypeError           DataType = "error"
	DataTypeUsers           DataType = "users"
	DataTypeSignIn          DataType = "signIn"
	DataTypeSignUp          DataType = "signUp"
	DataTypeSignOut         DataType = "signOut"
	DataTypeAuthorized      DataType = "authorized"
	DataTypeUnAuthorized    DataType = "unauthorized"
	DataTypeChannelJoin     DataType = "channelJoin"
	DataTypeChannelMessage  DataType = "channelMessage"
	DataTypeChannelMessages DataType = "channelMessages"
	DataTypeChannelLeave    DataType = "channelLeave"
)

type DataUnAuthorized

type DataUnAuthorized struct {
	UserUUID  string `json:"userUUID"`
	AccessKey string `json:"accessKey"`
}

type DataUsers

type DataUsers struct {
	Total    int              `json:"total"`
	Received int              `json:"received"`
	Users    []*rediscli.User `json:"users"`
}

type Error

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

func (Error) Error

func (err Error) Error() (uint32, error)

type IError

type IError interface {
	Error() (uint32, error)
}

type Message

type Message struct {
	SUUID          string              `json:"SUUID,omitempty"`
	Type           DataType            `json:"type"`
	UserUUID       string              `json:"userUUID,omitempty"`
	User           *rediscli.User      `json:"user,omitempty"`
	UserAccessKey  string              `json:"userAccessKey,omitempty"`
	Sys            *DataSys            `json:"sys,omitempty"`
	Ready          *DataReady          `json:"ready,omitempty"`
	Error          *DataError          `json:"error,omitempty"`
	Users          *DataUsers          `json:"users,omitempty"`
	SignIn         *DataSignIn         `json:"signIn,omitempty"`
	SignUp         *DataSignUp         `json:"signUp,omitempty"`
	SignOut        *DataSignOut        `json:"signOut,omitempty"`
	Authorized     *DataAuthorized     `json:"authorized,omitempty"`
	ChannelJoin    *DataChannelJoin    `json:"channelJoin,omitempty"`
	ChannelMessage *DataChannelMessage `json:"channelMessage,omitempty"`
	ChannelLeave   *DataChannelLeave   `json:"channelLeave,omitempty"`
	// contains filtered or unexported fields
}

func SysMessage

func SysMessage(message string) *Message

type Write

type Write func(conn io.ReadWriter, op ws.OpCode, message *Message) error

Jump to

Keyboard shortcuts

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