wasocket

package module
v0.0.8115 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 3 Imported by: 1

README

websocket

websocket backend for whatsauth

in main before fiber declaration: go wasocket.RunHub()

use in controller : a:=wasocket.RunSocket(c)

Publish

GOPROXY=proxy.golang.org

git tag v0.0.1
git push origin --tags
go list -m github.com/whatsauth/wasocket@v0.0.1

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 RunHub

func RunHub()

func RunSocket

func RunSocket(c *websocket.Conn) (Id string)

func SendMessageTo added in v0.0.4

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

func SendStructTo added in v0.0.4

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 Message

type Message struct {
	Id      string
	Message string

} // To send message to Id

Jump to

Keyboard shortcuts

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