Documentation
¶
Index ¶
- Constants
- Variables
- func GetListener(conn *websocket.Conn, req *http.Request) (w *ws.Listener)
- func New(s interfaces.Server, path string, sm *servemux.S)
- type A
- func (a *A) HandleAuth(req []byte, srv interfaces.Server, remote string) (msg []byte)
- func (a *A) HandleClose(req []byte, srv interfaces.Server, remote string) (note []byte)
- func (a *A) HandleEvent(c context.T, req []byte, srv interfaces.Server, remote string) (msg []byte)
- func (a *A) HandleMessage(msg []byte, remote string)
- func (a *A) HandleReq(c context.T, req []byte, srv interfaces.Server, remote string) (r []byte)
- func (a *A) Pinger(ctx context.T, ticker *time.Ticker, cancel context.F, remote string)
- func (a *A) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Close
- type Map
- type S
- type W
Constants ¶
View Source
const ( DefaultChallengeHRP = "nchal" DefaultChallengeLength = 16 )
View Source
const ( DefaultWriteWait = 10 * time.Second DefaultPongWait = 60 * time.Second DefaultPingWait = DefaultPongWait / 2 DefaultMaxMessageSize = 1 * units.Mb )
View Source
const Type = "socketapi"
Variables ¶
View Source
var (
NIP20prefixmatcher = regexp.MustCompile(`^\w+: `)
)
Functions ¶
func GetListener ¶
GetListener generates a new ws.Listener with a new challenge for a subscriber.
Types ¶
type A ¶
func (*A) HandleAuth ¶
func (*A) HandleClose ¶
func (*A) HandleEvent ¶
func (*A) HandleMessage ¶
type S ¶
type S struct {
// Mx is the mutex for the Map.
Mx sync.Mutex
// Map is the map of subscribers and subscriptions from the websocket api.
Map
}
func NewPublisher ¶
func NewPublisher() *S
Click to show internal directories.
Click to hide internal directories.