func New(c *conf.RPCServer, l *logic.NatsLogic) *grpc.Server {
	keepParams := grpc.KeepaliveParams(keepalive.ServerParameters{
		MaxConnectionIdle:     time.Duration(c.IdleTimeout),
		MaxConnectionAgeGrace: time.Duration(c.ForceCloseWait),
		Time:                  time.Duration(c.KeepAliveInterval),
		Timeout:               time.Duration(c.KeepAliveTimeout),
		MaxConnectionAge:      time.Duration(c.MaxLifeTime),
	})
	srv := grpc.NewServer(keepParams)
	pb.RegisterLogicServer(srv, &server{l})
	lis, err := net.Listen(c.Network, c.Addr)
	if err != nil {
		panic(err)
	}
	go func() {
		if err := srv.Serve(lis); err != nil {
			panic(err)
		}
	}()
	return srv
}
New logic grpc server
package grpc
import (
	"context"
	"net"
	"time"
	pb "github.com/tsingson/ex-goim/api/logic/grpc"
	"github.com/tsingson/ex-goim/goim-nats/logic"
	"github.com/tsingson/ex-goim/goim-nats/logic/conf"
	"google.golang.org/grpc"
	"google.golang.org/grpc/keepalive"
	_ "google.golang.org/grpc/encoding/gzip"
)