server-go/socket/web/servlet.go

54 lines
1.2 KiB
Go
Raw Normal View History

2018-04-06 00:15:29 +09:00
package web
2018-04-04 13:01:26 +09:00
import (
"git.loafle.net/commons/server-go"
2018-04-06 00:15:29 +09:00
"git.loafle.net/commons/server-go/socket"
2018-04-04 13:01:26 +09:00
"github.com/valyala/fasthttp"
)
type Servlet interface {
2018-04-06 00:15:29 +09:00
socket.Servlet
2018-04-04 13:01:26 +09:00
Handshake(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx) (*fasthttp.ResponseHeader, error)
}
2018-04-04 17:36:23 +09:00
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
}
2018-04-09 21:48:14 +09:00
func (s *Servlets) OnStart(serverCtx server.ServerCtx) error {
return nil
}
func (s *Servlets) OnStop(serverCtx server.ServerCtx) {
//
}
2018-04-04 17:36:23 +09:00
func (s *Servlets) Destroy(serverCtx server.ServerCtx) {
//
}
2018-04-05 01:51:34 +09:00
func (s *Servlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx) (*fasthttp.ResponseHeader, error) {
return nil, nil
2018-04-04 17:36:23 +09:00
}
2018-04-06 00:15:29 +09:00
func (s *Servlets) OnConnect(servletCtx server.ServletCtx, conn socket.Conn) {
2018-04-04 17:36:23 +09:00
//
}
func (s *Servlets) Handle(servletCtx server.ServletCtx, stopChan <-chan struct{}, doneChan chan<- struct{}, readChan <-chan []byte, writeChan chan<- []byte) {
}
2018-04-05 01:51:34 +09:00
func (s *Servlets) OnDisconnect(servletCtx server.ServletCtx) {
//
}