Skip to content

Commit 08aa6f1

Browse files
committed
Rename project to alpaca_websocket_proxy; static link openssl
1 parent 8e1df6c commit 08aa6f1

File tree

10 files changed

+171
-139
lines changed

10 files changed

+171
-139
lines changed

CMakeLists.txt

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
22

33
file (STRINGS "version" BUILD_VERSION)
44

5-
project(websocket_proxy
5+
project(alpaca_websocket_proxy
66
VERSION ${BUILD_VERSION}
77
LANGUAGES CXX)
88

@@ -20,51 +20,54 @@ if (CMAKE_BUILD_TYPE MATCHES Release)
2020
add_definitions(-DNDEBUG)
2121
endif()
2222

23+
set(VCPKG_TARGET_TRIPLET x64-windows-static)
24+
2325
set(RELEASE_DIR "${CMAKE_CURRENT_BINARY_DIR}/release")
24-
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/include" DESTINATION "${RELEASE_DIR}")
25-
configure_file(src/version.h.in release/include/websocket_proxy/version.h)
26+
configure_file(src/version.h.in release/include/alpaca_websocket_proxy/version.h)
27+
28+
set(OPENSSL_USE_STATIC_LIBS TRUE)
29+
set(OPENSSL_MSVC_STATIC_RT TRUE)
2630

2731
find_package(boost_beast REQUIRED CONFIG)
2832
find_package(OpenSSL REQUIRED)
2933
find_package(spdlog REQUIRED CONFIG)
30-
31-
set(OPENSSL_USE_STATIC_LIBS TRUE)
32-
set(OPENSSL_MSVC_STATIC_RT TRUE)
34+
add_definitions(-DSPDLOG_USE_STD_FORMAT -DSPDLOG_USE_STD_FORMAT_HO)
3335

3436
include(cmake/slick_queue.cmake)
3537

3638
set(HEADERS
37-
include/websocket_proxy/type.h
38-
include/websocket_proxy/websocket_proxy_client.h
39+
include/alpaca_websocket_proxy/type.h
40+
include/alpaca_websocket_proxy/alpaca_websocket_proxy_client.h
3941
)
4042

4143
set(SOURCES
4244
src/main.cpp
43-
src/websocket_proxy.cpp
45+
src/alpaca_websocket_proxy.cpp
4446
)
4547

46-
add_executable(websocket_proxy ${SOURCES})
47-
target_include_directories(websocket_proxy PUBLIC include ${slick_queue_SOURCE_DIR}/include ${spdlog_SOURCE_DIR} ${RELEASE_DIR}/include)
48-
target_link_libraries(websocket_proxy PRIVATE spdlog::spdlog Boost::asio Boost::beast OpenSSL::SSL OpenSSL::Crypto)
49-
target_precompile_headers(websocket_proxy PRIVATE src/pch.hpp)
48+
add_executable(alpaca_websocket_proxy ${SOURCES})
49+
target_include_directories(alpaca_websocket_proxy PUBLIC include ${slick_queue_SOURCE_DIR}/include ${spdlog_SOURCE_DIR} ${RELEASE_DIR}/include)
50+
target_link_libraries(alpaca_websocket_proxy PRIVATE spdlog::spdlog_header_only Boost::asio Boost::beast OpenSSL::SSL OpenSSL::Crypto)
51+
target_precompile_headers(alpaca_websocket_proxy PRIVATE src/pch.hpp)
5052

5153
if (MSVC)
5254
add_definitions(-D_WIN32_WINNT=0x0A00)
5355
set(CMAKE_SUPPRESS_REGENERATION true) # supress zero_check
54-
set_target_properties(websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
55-
set_target_properties(websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug")
56-
set_target_properties(websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin/Release")
57-
set_target_properties(websocket_proxy PROPERTIES LINK_INCREMENTAL ON)
58-
target_compile_definitions(websocket_proxy PUBLIC _UNICODE) # set CharacterSet to unicode
59-
target_compile_options(websocket_proxy PRIVATE "/bigobj")
60-
set_target_properties(websocket_proxy PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
56+
set_target_properties(alpaca_websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
57+
set_target_properties(alpaca_websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug")
58+
set_target_properties(alpaca_websocket_proxy PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin/Release")
59+
set_target_properties(alpaca_websocket_proxy PROPERTIES LINK_INCREMENTAL ON)
60+
target_compile_definitions(alpaca_websocket_proxy PUBLIC _UNICODE) # set CharacterSet to unicode
61+
target_compile_options(alpaca_websocket_proxy PRIVATE "/bigobj")
62+
set_target_properties(alpaca_websocket_proxy PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
6163
endif()
6264

6365
if (CMAKE_BUILD_TYPE MATCHES Release)
64-
add_custom_command(TARGET websocket_proxy
66+
add_custom_command(TARGET alpaca_websocket_proxy
6567
POST_BUILD
68+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/include ${RELEASE_DIR}/include
6669
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/Release ${RELEASE_DIR}/bin
67-
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "websocket_proxy_${BUILD_VERSION}.zip" --format=zip "${RELEASE_DIR}/bin" "${RELEASE_DIR}/include"
70+
COMMAND ${CMAKE_COMMAND} -E tar "cfv" "alpca_websocket_proxy_${BUILD_VERSION}.zip" --format=zip "${RELEASE_DIR}/bin" "${RELEASE_DIR}/include"
6871
WORKING_DIRECTORY "${RELEASE_DIR}"
6972
COMMENT "Creating zip archive"
7073
)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# WebsocketProxy: Share a Single WebSocket Connection for Multiple Clients (C++)
2-
WebSocketProxy provides a C++ WebSocket proxy framework that empowers you to share a single WebSocket connection among multiple clients, maximizing resource utilization and streamlining real-time data access.
1+
# AlpacaWebsocketProxy: Share a Single WebSocket Connection for Multiple Clients (C++)
2+
AlpacaWebSocketProxy provides a C++ WebSocket proxy framework that empowers you to share a single WebSocket connection among multiple clients, maximizing resource utilization and streamlining real-time data access.
33

44
## Built for Efficiency: Serving Multiple Clients with One Connection
5-
Designed initially for the [Alpaca.Market](https://alpaca.markets/), which offers data via both REST and WebSockets. However, Alpaca limits the number of concurrent WebSocket connections per account. WebSocketProxy solves this by enabling multiple strategies under the same account to receive real-tine market data updates through a single, shared WebSocket connection.
5+
Designed initially for the [Alpaca.Market](https://alpaca.markets/), which offers data via both REST and WebSockets. However, Alpaca limits the number of concurrent WebSocket connections per account. AlpacaWebSocketProxy solves this by enabling multiple strategies under the same account to receive real-tine market data updates through a single, shared WebSocket connection.
66

77
## Components and Communication
8-
WebSocketProxy consists of two components:
8+
AlpacaWebSocketProxy consists of two components:
99
1. Standalone proxy server executable: This executable acts as the central communication hub. It manages the connection to the WebSocket server and handles data forwarding between clients. It's launched upon the first client attempting a WebSocket connection, ensuring only one server instance runs simultaneously. Any subsequent server launch attempts automatically terminate, preventing resource conflicts. The server continues execution until all connected clients are closed.
1010
2. Header-only Proxy Client: This lightweight client library integrates into your individual applications. It manages communication with the proxy server and provides a familiar interface for sending and receiving data.
1111

12-
## Benefits of WebSocketProxy
12+
## Benefits of AlpacaWebSocketProxy
1313
* Efficient Resource Utilization: Share a single WebSocket connection, reducing overhead and improving resource management.
1414
* Real-Time Data Streamlining: Multiple trading strategies within an account gain access to crucial market updates concurrently.
1515
* Simplified Integration: The header-only client library enables effortless integration with your existing client applications.

0 commit comments

Comments
 (0)