This commit is contained in:
crusader 2017-11-14 12:45:48 +09:00
parent 65a0d2181d
commit a039ce356a
5 changed files with 69 additions and 2 deletions

View File

@ -1,2 +0,0 @@
package: git.loafle.net/overflow/overflow_gateway_webapp
import: []

33
main.go
View File

@ -1,5 +1,38 @@
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_gateway_webapp/server"
oogws "git.loafle.net/overflow/overflow_gateway_websocket/server"
)
func main() {
defer logging.Logger().Sync()
sh := &server.ServerHandlers{}
s := oogws.New(sh)
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)
go func() {
if err := s.Start(); nil != err {
log.Printf("Server: Start error %v", err)
return
}
}()
select {
case signal := <-stop:
fmt.Printf("Got signal: %v\n", signal)
}
s.Stop()
}

33
server/server_handlers.go Normal file
View File

@ -0,0 +1,33 @@
package server
import (
cwfs "git.loafle.net/commons_go/websocket_fasthttp/server"
)
type ServerHandlers struct {
cwfs.ServerHandlers
}
// Init invoked before the server is started
// If you override ths method, must call
func (sh *ServerHandlers) Init() error {
if err := sh.ServerHandlers.Init(); nil != err {
return err
}
return nil
}
func (sh *ServerHandlers) OnStart() {
sh.ServerHandlers.OnStart()
}
func (sh *ServerHandlers) OnStop() {
sh.ServerHandlers.OnStop()
}
func (sh *ServerHandlers) Validate() {
sh.ServerHandlers.Validate()
}

1
servlet/web/servlet.go Normal file
View File

@ -0,0 +1 @@
package web

View File

@ -0,0 +1,2 @@
package web