server-go/socket/web/servlet.go
crusader 265d562d31 ing
2018-04-09 21:48:14 +09:00

54 lines
1.2 KiB
Go

package web
import (
"git.loafle.net/commons/server-go"
"git.loafle.net/commons/server-go/socket"
"github.com/valyala/fasthttp"
)
type Servlet interface {
socket.Servlet
Handshake(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx) (*fasthttp.ResponseHeader, error)
}
type Servlets struct {
Servlet
}
func (s *Servlets) ServletCtx(serverCtx server.ServerCtx) server.ServletCtx {
return server.NewServletContext(nil, serverCtx)
}
func (s *Servlets) Init(serverCtx server.ServerCtx) error {
return nil
}
func (s *Servlets) OnStart(serverCtx server.ServerCtx) error {
return nil
}
func (s *Servlets) OnStop(serverCtx server.ServerCtx) {
//
}
func (s *Servlets) Destroy(serverCtx server.ServerCtx) {
//
}
func (s *Servlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx) (*fasthttp.ResponseHeader, error) {
return nil, nil
}
func (s *Servlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
//
}
func (s *Servlets) Handle(servletCtx server.ServletCtx, stopChan <-chan struct{}, doneChan chan<- struct{}, readChan <-chan []byte, writeChan chan<- []byte) {
}
func (s *Servlets) OnDisconnect(servletCtx server.ServletCtx) {
//
}