Skip to content

Commit

Permalink
hybrid was missing the registration of socket handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
theflyingcodr committed May 3, 2022
1 parent ceedf40 commit 0a8ed73
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/internal/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func SetupHybrid(cfg config.Config, l log.Logger, e *echo.Echo) *server.SocketSe
s := server.New(
server.WithMaxMessageSize(int64(cfg.Sockets.MaxMessageBytes)),
server.WithChannelTimeout(cfg.Sockets.ChannelTimeout))
// add middleware, with panic going first
s.WithMiddleware(smw.PanicHandler, smw.Timeout(smw.NewTimeoutConfig()), smw.Metrics())

paymentStore := socData.NewPayd(s)
paymentSvc := service.NewPayment(l, paymentStore)
if cfg.PayD.Noop {
Expand All @@ -140,6 +143,8 @@ func SetupHybrid(cfg config.Config, l log.Logger, e *echo.Echo) *server.SocketSe
dppHandlers.NewPaymentRequestHandler(paymentReqSvc).RegisterRoutes(g)
dppHandlers.NewProofs(proofsSvc).RegisterRoutes(g)
dppSoc.NewHealthHandler().Register(s)
dppSoc.NewPaymentRequest().Register(s)
dppSoc.NewPayment().Register(s)

e.GET("/ws/:channelID", wsHandler(s))
return s
Expand All @@ -149,6 +154,9 @@ func SetupHybrid(cfg config.Config, l log.Logger, e *echo.Echo) *server.SocketSe
func wsHandler(svr *server.SocketServer) echo.HandlerFunc {
upgrader := websocket.Upgrader{}
return func(c echo.Context) error {
upgrader.CheckOrigin = func(r *http.Request) bool {
return true
}
ws, err := upgrader.Upgrade(c.Response(), c.Request(), nil)
if err != nil {
return err
Expand Down

0 comments on commit 0a8ed73

Please sign in to comment.