ws: enable factory to react to state of ws conn

This commit is contained in:
Will Owens 2025-10-25 05:05:03 -05:00
parent 29695481fa
commit 42d8a51a93
No known key found for this signature in database
GPG key ID: 8C8384B16B623DA6
3 changed files with 7 additions and 3 deletions

View file

@ -115,8 +115,9 @@ func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn) e
return errors.Wrapf(err, "failed to parse arguments")
}
params := query.Query()
var slave Slave
slave, err = server.factory.New(params)
slave, err = server.factory.New(params, conn)
if err != nil {
return errors.Wrapf(err, "failed to create backend")
}

View file

@ -2,6 +2,8 @@ package server
import (
"github.com/ghthor/gotty/v2/webtty"
"github.com/gorilla/websocket"
)
// Slave is webtty.Slave with some additional methods.
@ -13,5 +15,5 @@ type Slave interface {
type Factory interface {
Name() string
New(params map[string][]string) (Slave, error)
New(params map[string][]string, conn *websocket.Conn) (Slave, error)
}