func InitWebsocket(server *Server, addrs []string, accept int) (err error) {
	var (
		bind     string
		listener *net.TCPListener
		addr     *net.TCPAddr
	)
	for _, bind = range addrs {
		if addr, err = net.ResolveTCPAddr("tcp", bind); err != nil {
			log.Errorf("net.ResolveTCPAddr(tcp, %s) error(%v)", bind, err)
			return
		}
		if listener, err = net.ListenTCP("tcp", addr); err != nil {
			log.Errorf("net.ListenTCP(tcp, %s) error(%v)", bind, err)
			return
		}
		log.Infof("start ws listen: %s", bind)
		// split N core accept
		for i := 0; i < accept; i++ {
			go acceptWebsocket(server, listener)
		}
	}
	return
}
// InitWebsocket listen all tcp.bind and start accept connections.
InitWebsocket listen all tcp.bind and start accept connections.
// InitWebsocket listen all tcp . bind and start accept connections .
func InitWebsocket(server *Server, addrs []string, accept int) (err error) {
	var (
		bind     string
		listener *net.TCPListener
		addr     *net.TCPAddr
	)
	for _, bind = range addrs {
		if addr, err = net.ResolveTCPAddr("tcp", bind); err != nil {
			log.Errorf("net.ResolveTCPAddr(tcp, %s) error(%v)", bind, err)
			return
		}
		if listener, err = net.ListenTCP("tcp", addr); err != nil {
			log.Errorf("net.ListenTCP(tcp, %s) error(%v)", bind, err)
			return
		}
		log.Infof("start ws listen: %s", bind)
		for i := 0; i < accept; i++ {
			go acceptWebsocket(server, listener)
		}
	}
	return
}
func InitWebsocket ( server * Server , addrs [ ] string , accept int ) ( err error ) { var ( bind string listener * net . TCPListener addr * net . TCPAddr ) for _ , bind = range addrs { if addr , err = net . ResolveTCPAddr ( " " , bind ) ; err != nil { log . Errorf ( " " , bind , err ) return } if listener , err = net . ListenTCP ( " " , addr ) ; err != nil { log . Errorf ( " " , bind , err ) return } log . Infof ( " " , bind ) for i := 0 ; i < accept ; i ++ { go acceptWebsocket ( server , listener ) } } return }
InitWebsocket listen all tcp.bind and start accept connections.
InitWebsocket listen all tcp . bind and start accept connections .
// split N core accept