Files
go-honeybee/types/types.go
T
Jay 19810798a7 config: add a read limit option to the connection.
By default, the read limit is never set by NewConnection.
When using the default pool dialer, a read limit of 512KB is set.
When the read limit option is set, all sockets passed to NewConnection have that read limit set.
2026-08-10 12:16:23 -04:00

39 lines
770 B
Go

package types
import (
"context"
"net/http"
"time"
)
type Dialer interface {
DialContext(ctx context.Context,
url string,
header http.Header,
) (Socket, *http.Response, error)
}
type Socket interface {
WriteMessage(messageType int, data []byte) error
WriteControl(messageType int, data []byte, deadline time.Time) error
ReadMessage() (messageType int, p []byte, err error)
Close() error
SetReadDeadline(t time.Time) error
SetWriteDeadline(t time.Time) error
SetCloseHandler(h func(code int, text string) error)
SetPongHandler(h func(appData string) error)
SetReadLimit(limit int64)
}
type ReceivedMessage struct {
Data []byte
ReceivedAt time.Time
}
type InboxMessage struct {
URL string
Data []byte
ReceivedAt time.Time
}