push

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(s PushServer) transport.ServerProtocol

NewServer return a server for pushing message

func Send

func Send(ctx context.Context, data []byte) error

Send push message to client

Types

type Client

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

Client is the pushing client

func NewClient

func NewClient(callback func(data []byte)) *Client

NewClient returns the client for pushing message

func (*Client) Connect

func (c *Client) Connect(req []byte) ([]byte, error)

Connect starts to connect to pushing server

func (*Client) SetServant

func (c *Client) SetServant(s model.Servant)

SetServant implements client servant

type PushServer

type PushServer interface {
	OnConnect(ctx context.Context, req []byte) []byte
	OnClose(ctx context.Context)
}

PushServer defines the pushing server

Jump to

Keyboard shortcuts

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