diff --git a/.gitignore b/.gitignore index 1ccde802ae..69577f4bf8 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ examples/echo_server_tls/echo_server_tls examples/concurrent_server/concurrent_server examples/fuzzing_server_tls/fuzzing_server + +examples/wsperf/wsperf diff --git a/examples/wsperf/Makefile b/examples/wsperf/Makefile index 8ec0204ab9..95e330108a 100644 --- a/examples/wsperf/Makefile +++ b/examples/wsperf/Makefile @@ -9,10 +9,18 @@ LDFLAGS = -L$(BOOST_LIB_PATH) CXX ?= c++ SHARED ?= "1" -ifeq ($(SHARED), 1) - LDFLAGS := $(LDFLAGS) -lwebsocketpp -lpthread -lboost_system -lboost_thread -lboost_random -lboost_regex -lboost_date_time -boost_chrono +OS=$(shell uname) + +ifeq ($(OS), Darwin) + darwinlibs = else - LDFLAGS := $(LDFLAGS) $(WEBSOCKETPP_PATH)/libwebsocketpp.a $(BOOST_LIB_PATH)/libboost_system.a $(BOOST_LIB_PATH)/libboost_date_time.a $(BOOST_LIB_PATH)/libboost_regex.a $(BOOST_LIB_PATH)/libboost_thread.a $(BOOST_LIB_PATH)/libboost_random.a $(BOOST_LIB_PATH)/libboost_chrono.a -lpthread + darwinlibs = -lrt -lpthread +endif + +ifeq ($(SHARED), 1) + LDFLAGS := $(LDFLAGS) -lwebsocketpp $(darwinlibs) -lboost_system -lboost_thread -lboost_random -lboost_regex -lboost_date_time -boost_chrono +else + LDFLAGS := $(LDFLAGS) $(WEBSOCKETPP_PATH)/libwebsocketpp.a $(BOOST_LIB_PATH)/libboost_system.a $(BOOST_LIB_PATH)/libboost_date_time.a $(BOOST_LIB_PATH)/libboost_regex.a $(BOOST_LIB_PATH)/libboost_thread.a $(BOOST_LIB_PATH)/libboost_random.a $(BOOST_LIB_PATH)/libboost_chrono.a $(darwinlibs) endif wsperf: wsperf.o diff --git a/examples/wsperf/wsperf b/examples/wsperf/wsperf index bccc036283..6680bd8b34 100755 Binary files a/examples/wsperf/wsperf and b/examples/wsperf/wsperf differ diff --git a/examples/wsperf/wsperf.cpp b/examples/wsperf/wsperf.cpp index 1cececebe2..1d039773b3 100644 --- a/examples/wsperf/wsperf.cpp +++ b/examples/wsperf/wsperf.cpp @@ -140,7 +140,7 @@ struct request { json.str("");*/ - json << "{\"type\":\"test_data\",\"target\":\"" << uri << "\",\"data\":" << tests[i]->get_data() << "}"; + json << "{\"type\":\"test_data\",\"uri\":\"" << uri << "\",\"token\":\"" << token << "\",\"data\":" << tests[i]->get_data() << "}"; con->send(json.str()); }