component.go 518 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "time"
  4. "git.bvbej.com/bvbej/base-golang/pkg/websocket/peer"
  5. )
  6. type Component interface {
  7. Init()
  8. OnSessionClose(*peer.Session) bool
  9. OnRequestFinished(*peer.Session, string, any, string, time.Duration)
  10. }
  11. type ComponentBase struct{}
  12. func (c *ComponentBase) Init() {
  13. }
  14. func (c *ComponentBase) OnSessionClose(session *peer.Session) bool {
  15. return false
  16. }
  17. func (c *ComponentBase) OnRequestFinished(session *peer.Session, router string, req any, errMsg string, delta time.Duration) {
  18. }