Documentation
¶
Overview ¶
Package websubecho mounts websub handlers on an echo router.
The three websub types are ordinary net/http.Handler values, so this adapter is one call to echo's own wrapper. There is no protocol logic here, and there should never be any.
sub, err := websub.NewSubscriber("https://example.com/websub/")
e := echo.New()
e.Any("/websub/*", websubecho.Handler(sub))
Note the wildcard. Each subscription gets its own callback below the URL the subscriber was built with, so the route must match a prefix rather than one exact path. A hub serves a single URL and needs no wildcard:
e.POST("/hub", websubecho.Handler(hub))
A publisher advertises its hub through response headers rather than serving a route of its own, so wrap whatever already serves the topic:
e.GET("/feed", websubecho.Handler(publisher.Middleware("/feed", feed)))
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(h http.Handler) echo.HandlerFunc
Handler adapts a websub handler, meaning a websub.Subscriber, websub.Publisher middleware, or websub.Hub, for use as an echo.HandlerFunc.
Types ¶
This section is empty.