Skip to content

Commit 9c658c5

Browse files
authoredFeb 10, 2025
Merge branch 'master' into feat/support-setting-ufrag-and-pwd
2 parents 40dfca6 + 5eb8107 commit 9c658c5

7 files changed

+19
-5
lines changed
 

‎CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
22
cmake_policy(SET CMP0091 NEW)
33
cmake_policy(SET CMP0042 NEW)
44

5-
project(node_datachannel VERSION 0.24.0)
5+
project(node_datachannel VERSION 0.25.0)
66

77
# -Dnapi_build_version=8
88
add_definitions(-DNAPI_VERSION=8)

‎package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-datachannel",
3-
"version": "0.24.0",
3+
"version": "0.25.0",
44
"description": "WebRTC For Node.js and Electron. libdatachannel node bindings.",
55
"main": "./dist/cjs/lib/index.cjs",
66
"module": "./dist/esm/lib/index.mjs",

‎src/cpp/rtc-wrapper.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Napi::Object RtcWrapper::Init(Napi::Env env, Napi::Object exports)
1818
exports.Set("cleanup", Napi::Function::New(env, &RtcWrapper::cleanup));
1919
exports.Set("preload", Napi::Function::New(env, &RtcWrapper::preload));
2020
exports.Set("setSctpSettings", Napi::Function::New(env, &RtcWrapper::setSctpSettings));
21+
exports.Set("getLibraryVersion", Napi::Function::New(env, &RtcWrapper::getLibraryVersion));
2122

2223
return exports;
2324
}
@@ -172,3 +173,11 @@ void RtcWrapper::setSctpSettings(const Napi::CallbackInfo &info)
172173

173174
rtc::SetSctpSettings(settings);
174175
}
176+
177+
178+
Napi::Value RtcWrapper::getLibraryVersion(const Napi::CallbackInfo &info)
179+
{
180+
PLOG_DEBUG << "getLibraryVersion() called";
181+
Napi::Env env = info.Env();
182+
return Napi::String::New(info.Env(), RTC_VERSION);
183+
}

‎src/cpp/rtc-wrapper.h

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class RtcWrapper
1818
static void initLogger(const Napi::CallbackInfo &info);
1919
static void cleanup(const Napi::CallbackInfo &info);
2020
static void setSctpSettings(const Napi::CallbackInfo &info);
21+
static Napi::Value getLibraryVersion(const Napi::CallbackInfo &info);
2122
private:
2223
static inline std::unique_ptr<ThreadSafeCallback> logCallback = nullptr;
2324
static inline std::mutex iceUdpMuxListenersMutex;

‎src/lib/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export function preload(): void { nodeDataChannel.preload(); }
99
export function initLogger(level: LogLevel): void { nodeDataChannel.initLogger(level); }
1010
export function cleanup(): void { nodeDataChannel.cleanup(); }
1111
export function setSctpSettings(settings: SctpSettings): void { nodeDataChannel.setSctpSettings(settings); }
12+
export function getLibraryVersion(): string { return nodeDataChannel.getLibraryVersion(); }
1213

1314
export interface Audio {
1415
addAudioCodec(payloadType: number, codec: string, profile?: string): void;
@@ -170,6 +171,7 @@ export default {
170171
cleanup,
171172
preload,
172173
setSctpSettings,
174+
getLibraryVersion,
173175
RtcpReceivingSession,
174176
Track,
175177
Video,

‎src/polyfill/RTCDataChannel.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ export default class RTCDataChannel extends EventTarget implements globalThis.RT
191191

192192
close(): void {
193193
this.#closeRequested = true;
194-
this.#dataChannel.close();
194+
setImmediate(() => {
195+
this.#dataChannel.close();
196+
});
195197
}
196198
}

0 commit comments

Comments
 (0)