ws

package
v0.4.20 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnectionClosed = errors.New("connection closed")

Functions

This section is empty.

Types

type Conn

type Conn struct {
	RH *RegistryHandler
	// contains filtered or unexported fields
}

func NewConn

func NewConn(l *zap.Logger) *Conn

func (*Conn) Attach

func (conn *Conn) Attach(name string, handler conn.Handler)

func (*Conn) AttachToMux

func (conn *Conn) AttachToMux(mux *http.ServeMux)

type JsonRPCError

type JsonRPCError struct {
	Code    int64         `json:"code"`
	Message string        `json:"message"`
	Data    []interface{} `json:"data"`
}

type JsonRPCRequest

type JsonRPCRequest struct {
	ID      uint64        `json:"id"`
	JSONRPC string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
}

type JsonRPCResponse

type JsonRPCResponse struct {
	ID      uint64          `json:"id"`
	JSONRPC string          `json:"jsonrpc"`
	Error   *JsonRPCError   `json:"error,omitempty"`
	Result  json.RawMessage `json:"result"`
}

type JsonRPCSend

type JsonRPCSend struct {
	JsonRPCRequest
	RespCH chan Response
}

type LockedResponseMap

type LockedResponseMap struct {
	Map map[uint64]ResponseStore
	L   sync.RWMutex
}

type RegistryHandler

type RegistryHandler struct {
	Registry map[string]conn.Handler
	// contains filtered or unexported fields
}

func (*RegistryHandler) Add

func (rh *RegistryHandler) Add(name string, handler conn.Handler)

func (*RegistryHandler) Get

func (rh *RegistryHandler) Get(name string) (h conn.Handler, ok bool)

type Response

type Response struct {
	ID     uint64
	Error  error
	Type   string
	Result json.RawMessage
}

type ResponseStore

type ResponseStore struct {
	ID     uint64 `json:"id"` // originalID
	Type   string
	RespCH chan Response
}

type Session

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

func NewSession

func NewSession() *Session

type SessionRequest

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

func (*SessionRequest) Arguments

func (sR *SessionRequest) Arguments() []interface{}

type SessionResponse

type SessionResponse struct {
	ID uint64

	SessionContext context.Context
	RespCh         chan JsonRPCResponse
}

func (*SessionResponse) Send

func (sR *SessionResponse) Send(data io.ReadCloser, err error) error

func (*SessionResponse) Write

func (sR *SessionResponse) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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