func InitRPCPush(addrs []string) (err error) { var ( bind string network, addr string c = &PushRPC{} ) rpc.Register(c) for _, bind = range addrs { if network, addr, err = inet.ParseNetwork(bind); err != nil { log.Error("inet.ParseNetwork() error(%v)", err) return } go rpcListen(network, addr) } return }
func InitHTTP() (err error) { // http listen var network, addr string for i := 0; i < len(Conf.HTTPAddrs); i++ { httpServeMux := http.NewServeMux() httpServeMux.HandleFunc("/1/push", Push) httpServeMux.HandleFunc("/1/pushs", Pushs) httpServeMux.HandleFunc("/1/push/all", PushAll) httpServeMux.HandleFunc("/1/push/room", PushRoom) httpServeMux.HandleFunc("/1/server/del", DelServer) httpServeMux.HandleFunc("/1/count", Count) log.Info("start http listen:\"%s\"", Conf.HTTPAddrs[i]) if network, addr, err = inet.ParseNetwork(Conf.HTTPAddrs[i]); err != nil { log.Error("inet.ParseNetwork() error(%v)", err) return } go httpListen(httpServeMux, network, addr) } return }