ws

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 6 Imported by: 13

README

ws

Fiber Websocket V2 helper

go get -u all					#update existing package
go mod tidy					#generate go mod
git tag                                 	#check current version
git tag v0.0.3                          	#set tag version
git push origin --tags                  	#push tag version to repo
go list -m github.com/whatsauth/ws@v0.0.3   #publish to pkg dev, replace ORG/URL with your repo URL

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Clients = make(map[string]*websocket.Conn) // Note: although large maps with pointer-like types (e.g. strings) as keys are slow, using pointers themselves as keys is acceptable and fast
View Source
var Register = make(chan Client) // Register channel for Client Struct
View Source
var SendMesssage = make(chan Message)
View Source
var Unregister = make(chan string)

Functions

func GetUUID added in v0.0.2

func GetUUID(msg model.IteungMessage, keyword string) string

func IsLoginRequest added in v0.0.2

func IsLoginRequest(msg model.IteungMessage, keyword string) bool

func MagicLinkEvent

func MagicLinkEvent(roomId string, PublicKey, PrivateKey string)

func RunHub

func RunHub()

func RunSocket

func RunSocket(c *websocket.Conn, PublicKey, PrivateKey string) (Id string)

func SendMessageTo

func SendMessageTo(ID string, msg string) (res bool)

func SendStructTo

func SendStructTo(ID string, strc interface{}) (res bool)

Types

type Client

type Client struct {
	Id   string
	Conn *websocket.Conn

} // Register Conn socket with ID

type LoginInfo

type LoginInfo struct {
	Phone string `json:"phone,omitempty" bson:"phone,omitempty"`
	Login string `json:"login,omitempty" bson:"login,omitempty"`
	Uuid  string `json:"uuid,omitempty" bson:"uuid,omitempty"`
}

type Message

type Message struct {
	Id      string
	Message string

} // To send message to Id

type WhatsauthRequest

type WhatsauthRequest struct {
	Uuid        string `json:"uuid,omitempty" bson:"uuid,omitempty"`
	Phonenumber string `json:"phonenumber,omitempty" bson:"phonenumber,omitempty"`
	Delay       uint32 `json:"delay,omitempty" bson:"delay,omitempty"`
}

Jump to

Keyboard shortcuts

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