Documentation
¶
Overview ¶
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
* * Frank Willem Mulder * __________________ * * Copyright 2026 Frank Willem Mulder. All rights reserved. * Use of this source code is governed license that can be found in the LICENSE file.
Index ¶
- Constants
- func DecodeMsg(buf []byte) (uint16, []byte, []byte)
- func EncodeMsg(buf []byte) []byte
- func Int16ToLen(le uint16) []byte
- func LenToInt16(buf []byte) uint16
- func MsgString(buf []byte) string
- func NewTlsConfig() *tls.Config
- type Client
- func (c *Client) Get(tix int, ks ...any) (ot.FactI[any], bool)
- func (c *Client) GetN(tix int, ks []any) (ot.FactI[any], bool)
- func (client *Client) GetReadCh() chan []byte
- func (client *Client) GetStopCh() chan bool
- func (c *Client) Name() string
- func (c *Client) Publish(pubs ...string)
- func (c *Client) Query(tix int) []ot.FactI[any]
- func (c *Client) QueryN(tix int, ks []any) []ot.FactI[any]
- func (c *Client) Stop(sendByClient bool)
- func (c *Client) Subscribe(subs ...string)
- type ClientI
- type ClientState
- type Hartbeat
- type MayfairClient
- type MayfairServer
- type MqttClient
- type Nwp
- type Ping
- type Pong
- type PubSubs
- type Stop
Constants ¶
const MaxMsgSize = 65536
const MqttBroker = "127.0.0.1"
const MqttPort = 1883
const SockLocalHost = "127.0.0.1"
const SockNetwork = "tcp"
const SockPort = 8677
Variables ¶
This section is empty.
Functions ¶
func Int16ToLen ¶
func LenToInt16 ¶
func NewTlsConfig ¶
Types ¶
type Client ¶
type ClientI ¶
type ClientI interface {
Publish(pubs ...string)
Subscribe(subs ...string)
Listen(debug bool)
Get(tix int, ks ...any) (ot.FactI[any], bool)
GetN(tix int, ks []any) (ot.FactI[any], bool)
Query(tix int) []ot.FactI[any]
QueryN(tix int, ks []any) []ot.FactI[any]
Put(f ot.FactI[any]) ot.TransactionType
Stop(bool)
Close()
Name() string
GetReadCh() chan []byte
GetStopCh() chan bool
}
type Hartbeat ¶
type Hartbeat struct {
ot.Fact[any]
Client string `json:"client"`
Version int `json:"version"`
Stamp time.Time `json:"time"`
}
Hartbeat is the main alive message sent by a client to the server
func NewHartbeat ¶
type MayfairClient ¶
type MayfairClient struct {
Client
// contains filtered or unexported fields
}
func NewMayfairClient ¶
func NewMayfairClient(network string, host string, port int, ps PubSubs) *MayfairClient
func (*MayfairClient) Close ¶
func (c *MayfairClient) Close()
Close closes all the connections and channes of a client when the stop msg has been received by the main client process
func (*MayfairClient) Listen ¶
func (c *MayfairClient) Listen(debug bool)
Listen handles all incoming messages and outgoing messages from, to the mayfair db server
func (*MayfairClient) Put ¶
func (c *MayfairClient) Put(f ot.FactI[any]) ot.TransactionType
type MayfairServer ¶
type MayfairServer struct {
// contains filtered or unexported fields
}
func NewMayfairServer ¶
func NewMayfairServer(network string, host string, port int) *MayfairServer
func (*MayfairServer) Listen ¶
func (server *MayfairServer) Listen(debug bool)
Listen listens waits for connections made by clients and sets up the processing of the messages of a client through the connection
type MqttClient ¶
type MqttClient struct {
Client
// contains filtered or unexported fields
}
func NewMqttClient ¶
func NewMqttClient(network string, host string, port int, ps PubSubs) *MqttClient
func (*MqttClient) Close ¶
func (c *MqttClient) Close()
Close closes all the connections and channes of a client when the stop msg has been received by the main client process
func (*MqttClient) Listen ¶
func (c *MqttClient) Listen(debug bool)
Listen handles all incoming messages and outgoing messages from, to the mayfair db server
func (*MqttClient) Put ¶
func (c *MqttClient) Put(f ot.FactI[any]) ot.TransactionType
type Ping ¶
type Ping struct {
ot.Fact[any]
Id int `fact:"key"`
Msg string `json:"msg"`
Version int `json:"version"`
}
Ping is used for testing messages
type Pong ¶
type PubSubs ¶
type PubSubs struct {
Name string `json:"name"`
Pubs []string `json:"pubs"`
Subs []string `json:"subs"`
}
PubSubs is the publish/subscribe administration for a client