Skip to content

add websocket servers for amcp and monitor data #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
dfafbf1
add websocket servers for amcp and monitor
TomKaltz Jul 3, 2025
fdba8b5
allow monitor client to request full_state
TomKaltz Jul 4, 2025
15c5dce
linux build fix
TomKaltz Jul 4, 2025
f15cf8b
enable permessage_deflate for websocketes
TomKaltz Jul 4, 2025
734367a
ignore boost deprecation warning
TomKaltz Jul 4, 2025
126b73e
fix request_full_state
TomKaltz Jul 4, 2025
646b834
Merge remote-tracking branch 'origin/master' into tk-ws
TomKaltz Jul 4, 2025
d44cd75
upgrade to io_context
TomKaltz Jul 4, 2025
22756a6
utf8 handling and compression
TomKaltz Jul 4, 2025
e79a6e5
keep global state so channels don't overwrite
TomKaltz Jul 5, 2025
a08e1b6
simplify implementation and kick slow websocket clients after 300 que…
TomKaltz Jul 5, 2025
0760030
fix dangling pointer issue that would cause bad websocket frames
TomKaltz Jul 5, 2025
692fa3d
log slow clients
TomKaltz Jul 5, 2025
85a19cd
switch to RFC3786 change deltas and fix diffing strategy to properly …
TomKaltz Jul 5, 2025
5743681
remove change deltas, drop messages when write failing, close connect…
TomKaltz Jul 10, 2025
d91a7b2
implement path subscriptions
TomKaltz Jul 11, 2025
43950b8
reintroduce request_full_state command
TomKaltz Jul 11, 2025
943ab88
don't send to websocket clients on main thread
TomKaltz Jul 11, 2025
8f3780a
use thread pool for websocket connections, never block main thread fo…
TomKaltz Jul 13, 2025
4d86758
refactor files
TomKaltz Jul 13, 2025
87750ed
improve threading model and log dropped messages
TomKaltz Jul 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CMakeModules/Bootstrap_Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ find_package(TBB REQUIRED)
find_package(OpenAL REQUIRED)
find_package(SFML 2 COMPONENTS graphics window REQUIRED)
find_package(X11 REQUIRED)
# nlohmann-json must be provided by the distribution package (nlohmann-json3-dev)
find_package(nlohmann_json 3.10.0 REQUIRED)

# support for Ubuntu 22.04
if (NOT TARGET OpenAL::OpenAL)
Expand Down
9 changes: 8 additions & 1 deletion src/CMakeModules/Bootstrap_Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ file(COPY_FILE ${openal_SOURCE_DIR}/bin/Win64/soft_oal.dll ${openal_SOURCE_DIR}/
add_library(OpenAL::OpenAL INTERFACE IMPORTED)
target_include_directories(OpenAL::OpenAL INTERFACE ${openal_SOURCE_DIR}/include)
target_link_directories(OpenAL::OpenAL INTERFACE ${openal_SOURCE_DIR}/libs/Win64)

# nlohmann/json
FetchContent_Declare(nlohmann_json
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
)
FetchContent_MakeAvailable(nlohmann_json)
target_link_libraries(OpenAL::OpenAL INTERFACE OpenAL32)
casparcg_add_runtime_dependency("${openal_SOURCE_DIR}/bin/Win64/OpenAL32.dll")

Expand Down Expand Up @@ -286,6 +293,6 @@ add_definitions("-DBOOST_ALLOW_DEPRECATED_HEADERS")
# Ensure /EHsc is not defined as it clashes with EHa below
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zi /W4 /WX /MP /fp:fast /Zm192 /FIcommon/compiler/vs/disable_silly_warnings.h")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zi /W4 /MP /fp:fast /Zm192 /FIcommon/compiler/vs/disable_silly_warnings.h")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D TBB_USE_ASSERT=1 /D TBB_USE_DEBUG /bigobj")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /arch:AVX2 /Ot /Gy /bigobj")
8 changes: 7 additions & 1 deletion src/protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ set(SOURCES
util/strategy_adapters.cpp
util/http_request.cpp
util/tokenize.cpp
util/websocket_server.cpp
util/websocket_monitor_client.cpp
util/websocket_monitor_server.cpp
)

set(HEADERS
Expand Down Expand Up @@ -54,6 +57,9 @@ set(HEADERS
util/strategy_adapters.h
util/http_request.h
util/tokenize.h
util/websocket_server.h
util/websocket_monitor_client.h
util/websocket_monitor_server.h

StdAfx.h
)
Expand All @@ -73,4 +79,4 @@ source_group(sources\\osc osc/*)
source_group(sources\\util util/*)
source_group(sources ./*)

target_link_libraries(protocol PRIVATE common core)
target_link_libraries(protocol PRIVATE common core nlohmann_json::nlohmann_json)
3 changes: 3 additions & 0 deletions src/protocol/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN

// Suppress Boost bind deprecation warning
#define BOOST_BIND_GLOBAL_PLACEHOLDERS

#if defined(_MSC_VER)
#ifndef _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
Expand Down
Loading