Skip to content

Latest commit

 

History

History
46 lines (40 loc) · 1.39 KB

README.md

File metadata and controls

46 lines (40 loc) · 1.39 KB

vivy-polaris

The project name has nothing to do with the actual content of this framework, just enjoyed the musical interlude <<Ensemble for Polaris>> of <<Vivy: Fluorite Eye's Song>> recently.

TODO

Useage

server

import (
    vp_server "github.com/shenjing023/vivy-polaris/server"
    "log"
    "net"
    "os"
    "os/signal"
    "syscall"

    pb "xxxx"
)

func main() {
    lis, err := net.Listen("tcp", fmt.Sprintf(":%d", 8888))
    if err != nil {
        log.Fatalf("failed to listen: %+v", err)
    }
    s := vp_server.NewServer()
    pb.RegisterXXXXXServer(s, &handler.Server{})
    go func() {
        if err := s.Serve(lis); err != nil {
            log.Fatalf("failed to serve: %+v", err)
        }
    }()
    log.Printf("%s server start success, port: %d", conf.ServerCfg.ServerName, conf.ServerCfg.Port)

    // Wait for interrupt signal to gracefully shutdown the server
    quit := make(chan os.Signal, 1)
    signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT)
    <-quit
    log.Printf("signal %d received and shutdown service", quit)
    s.GracefulStop()
}