stream

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventHandler

func NewEventHandler(broadcast func(query string, message []byte),
	directMessage func(userID int64, sessionID string, query string, message []byte)) *eventHandler

Types

type BroadcastClient

type BroadcastClient interface {
	Broadcast(query string, message []byte)
}

BroadcastClient ...

type Client

type Client struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(ws *websocket.Conn, user *m.User, sessionId string) *Client

NewClient ...

func (*Client) Close

func (c *Client) Close()

Close ...

func (*Client) GetUser

func (c *Client) GetUser() *m.User

func (*Client) Send

func (c *Client) Send(id, query string, body []byte) (err error)

Send ...

func (*Client) SessionID

func (c *Client) SessionID() string

func (*Client) WritePump

func (c *Client) WritePump(f func(*Client, string, string, []byte))

WritePump ...

type IDirectMessage

type IDirectMessage interface {
	DirectMessage(userId int64, sessionId string, query string, message []byte)
}

IDirectMessage ...

type IStreamClient

type IStreamClient interface {
	GetUser() *m.User
	SessionID() string
	Send(id string, query string, body []byte) error
}

IStreamClient ...

type Message

type Message struct {
	Id    string `json:"id"`
	Query string `json:"query"`
	Body  []byte `json:"body"`
}

type Stream

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

Stream ...

func NewStreamService

func NewStreamService(lc fx.Lifecycle,
	eventBus bus.Bus) (s *Stream)

NewStreamService ...

func (*Stream) Broadcast

func (s *Stream) Broadcast(query string, message []byte)

Broadcast ...

func (*Stream) DirectMessage

func (s *Stream) DirectMessage(userID int64, sessionID string, query string, message []byte)

DirectMessage ...

func (*Stream) NewConnection

func (s *Stream) NewConnection(ws *websocket.Conn, user *m.User)

NewConnection ...

func (*Stream) Recv

func (s *Stream) Recv(client *Client, id, query string, b []byte)

Recv ...

func (*Stream) Shutdown

func (s *Stream) Shutdown(_ context.Context) error

Shutdown ...

func (*Stream) Start

func (s *Stream) Start(_ context.Context) error

Start ...

func (*Stream) Subscribe

func (s *Stream) Subscribe(command string, f func(IStreamClient, string, []byte))

Subscribe ...

func (*Stream) UnSubscribe

func (s *Stream) UnSubscribe(command string)

UnSubscribe ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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