diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index 50d8072..0000000 --- a/glide.yaml +++ /dev/null @@ -1,2 +0,0 @@ -package: git.loafle.net/overflow/overflow_gateway_webapp -import: [] diff --git a/main.go b/main.go index 7905807..d02eb44 100644 --- a/main.go +++ b/main.go @@ -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() } diff --git a/server/server_handlers.go b/server/server_handlers.go new file mode 100644 index 0000000..7b5b343 --- /dev/null +++ b/server/server_handlers.go @@ -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() +} diff --git a/servlet/web/servlet.go b/servlet/web/servlet.go new file mode 100644 index 0000000..efb3895 --- /dev/null +++ b/servlet/web/servlet.go @@ -0,0 +1 @@ +package web diff --git a/servlet/web/subscriber_handlers.go b/servlet/web/subscriber_handlers.go new file mode 100644 index 0000000..24df326 --- /dev/null +++ b/servlet/web/subscriber_handlers.go @@ -0,0 +1,2 @@ +package web +