func handle_backend(lbbroker *lbbroker_t) error {
	msg, err := lbbroker.backend.RecvMessage(0)
	if err != nil {
		return err
	}
	identity, msg := unwrap(msg)
	lbbroker.workers = append(lbbroker.workers, identity)
	if len(lbbroker.workers) == 1 {
		lbbroker.reactor.AddSocket(lbbroker.frontend, zmq.POLLIN,
			func(e zmq.State) error { return handle_frontend(lbbroker) })
	}
	if msg[0] != WORKER_READY {
		lbbroker.frontend.SendMessage(msg)
	}
	return nil
}
Handle input from worker, on backend
package main
import (
	zmq "github.com/pebbe/zmq4"
	"fmt"
	"strings"
	"time"
)
const (
	NBR_CLIENTS  = 10
	NBR_WORKERS  = 3
	WORKER_READY = "\001"  
)
func client_task() {
	client, _ := zmq.NewSocket(zmq.REQ)
	defer client.Close()
	client.Connect("ipc://frontend.ipc")
	for {
		client.SendMessage("HELLO")
		reply, _ := client.RecvMessage(0)
		if len(reply) == 0 {
			break
		}
		fmt.Println("Client:", strings.Join(reply, "\n\t"))
		time.Sleep(time.Second)
	}
}
func worker_task() {
	worker, _ := zmq.NewSocket(zmq.REQ)
	defer worker.Close()
	worker.Connect("ipc://backend.ipc")
	worker.SendMessage(WORKER_READY)
	for {
		msg, e := worker.RecvMessage(0)
		if e != nil {
			break  
		}
		msg[len(msg)-1] = "OK"
		worker.SendMessage(msg)
	}
}
type lbbroker_t struct {
	frontend *zmq.Socket  
	backend  *zmq.Socket  
	workers  []string     
	reactor  *zmq.Reactor
}
func handle_frontend(lbbroker *lbbroker_t) error {
	msg, err := lbbroker.frontend.RecvMessage(0)
	if err != nil {
		return err
	}
	lbbroker.backend.SendMessage(lbbroker.workers[0], "", msg)
	lbbroker.workers = lbbroker.workers[1:]
	if len(lbbroker.workers) == 0 {
		lbbroker.reactor.RemoveSocket(lbbroker.frontend)
	}
	return nil
}