2024-07-23 10:23:43 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2024-07-31 16:49:14 +08:00
|
|
|
"gitea.bvbej.com/bvbej/base-golang/pkg/websocket/peer"
|
2024-07-23 10:23:43 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type Component interface {
|
|
|
|
Init()
|
|
|
|
OnSessionClose(*peer.Session) bool
|
|
|
|
OnRequestFinished(*peer.Session, string, any, string, time.Duration)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ComponentBase struct{}
|
|
|
|
|
|
|
|
func (c *ComponentBase) Init() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ComponentBase) OnSessionClose(session *peer.Session) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ComponentBase) OnRequestFinished(session *peer.Session, router string, req any, errMsg string, delta time.Duration) {
|
|
|
|
|
|
|
|
}
|