Documentation
¶
Index ¶
- type FrameMessage
- type Handler
- type Option
- type Session
- func (s *Session) Error() error
- func (s *Session) EventsAfter(lastID uint64) [][]byte
- func (s *Session) NextRequestID() jsonrpc.RequestId
- func (s *Session) SendData(ctx context.Context, data []byte)
- func (s *Session) SendError(ctx context.Context, error *jsonrpc.Error)
- func (s *Session) SendRequest(ctx context.Context, request *jsonrpc.Request)
- func (s *Session) SendResponse(ctx context.Context, response *jsonrpc.Response)
- func (s *Session) SetError(err error)
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameMessage ¶
FrameMessage is a function type that allows wrapping of the message before sending it to the client
type Handler ¶
type Handler struct {
Sessions *collection.SyncMap[string, *Session]
Logger jsonrpc.Logger // Logger for error messages
}
Handler represents a jsonrpc endpoint
func NewHandler ¶
func NewHandler() *Handler
type Option ¶
type Option func(s *Session)
Option represents option
func WithEventBuffer ¶ added in v0.6.0
WithEventBuffer sets size of in-memory event buffer for session so that server can re-deliver messages on Last-Event-ID reconnect.
func WithFramer ¶
func WithFramer(framer FrameMessage) Option
type Session ¶
type Session struct {
Id string `json:"id"`
RoundTrips *transport.RoundTrips
Writer io.Writer
Handler transport.Handler
RequestIdSeq uint64
sync.Mutex
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) EventsAfter ¶ added in v0.6.0
EventsAfter returns buffered framed messages with id greater than lastID.
func (*Session) NextRequestID ¶ added in v0.7.1
func (*Session) SendRequest ¶
SendRequest sends response
func (*Session) SendResponse ¶
SendResponse sends response
type Transport ¶
Transport represents a Transport
func NewTransport ¶
func NewTransport(tripper *transport.RoundTrips, sendData func(ctx context.Context, data []byte), session *Session) *Transport
NewTransport creates a new Transport
func (*Transport) NextRequestID ¶ added in v0.7.1
Click to show internal directories.
Click to hide internal directories.