client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_IDENTITY       = "identity"
	EVENT_SUBSCRIBER_ACK = "subscriber_ack"
)
View Source
const (
	DEFAULT_ENVIRONMENT = "prod"
	DEFAULT_DOMAIN      = "localhost:3000"
	DEFAULT_LOG_LEVEL   = "error"
)

Variables

This section is empty.

Functions

func HandleEvents added in v0.1.3

func HandleEvents()

func HandleIncomingMessages

func HandleIncomingMessages(connection *websocket.Conn)

Needed to receive server events Right now we do nothing, but its here to avoid errors on the protocol

func HandleSendEvents

func HandleSendEvents(connection *websocket.Conn)

func HandleWebsocketClose

func HandleWebsocketClose(message ControllerMessage)

func InitClient

func InitClient() *websocket.Conn

func Main

func Main()

func ScanFile

func ScanFile()

func SendIdentity

func SendIdentity(connection *websocket.Conn, clientId string)

Types

type ClientOptions

type ClientOptions struct {
	Env          string
	Domain       *utils.Domain
	LogLevel     zapcore.Level
	PeerId       string
	Listen       bool
	Output       bool
	UrlClipboard bool
}

func InitOptions

func InitOptions() *ClientOptions

type ControllerMessage

type ControllerMessage struct {
	Message    string
	Error      error
	Connection *websocket.Conn
}

type IdentityMessage

type IdentityMessage struct {
	PeerId      string `json:"peerId"`
	Broadcaster bool   `json:"broadcaster"`
	Subscriber  bool   `json:"subscriber"`
}

type LogMessage

type LogMessage struct {
	Line string `json:"line"`
}

type Message

type Message struct {
	Id      string      `json:"id"`
	Payload interface{} `json:"payload"`
	Event   string      `json:"event"`
}

func NewMessage added in v0.1.3

func NewMessage(message []byte) (Message, error)

func (Message) MarshalLogObject

func (message Message) MarshalLogObject(encoder zapcore.ObjectEncoder) error

func (Message) MarshalPayload added in v0.1.3

func (m Message) MarshalPayload() ([]byte, error)

func (Message) ToSubscriberConnectedMessage added in v0.1.3

func (m Message) ToSubscriberConnectedMessage() (SubscriberConnectedMessage, error)

type SubscriberConnectedMessage added in v0.1.3

type SubscriberConnectedMessage struct {
	Connected bool `json:"connected"`
}

Jump to

Keyboard shortcuts

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