diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-11-12 20:29:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 20:29:24 +0000 |
commit | ac1a49725fc038ae11ef9060fecb2b0f9c6333b2 (patch) | |
tree | c7341bd56c977259578b127886c9a88eeef11820 /modules/websocket/websocket_peer.cpp | |
parent | 5094c2a5f7d506b0e685120f14d1df42e1e9d495 (diff) | |
parent | 3a73c6ebd18bff0fa125be58d3ac9c7a63bab61d (diff) | |
download | redot-engine-ac1a49725fc038ae11ef9060fecb2b0f9c6333b2.tar.gz |
Merge pull request #855 from Spartan322/merge/cb411fa
Merge commit godotengine/godot@cb411fa
Diffstat (limited to 'modules/websocket/websocket_peer.cpp')
-rw-r--r-- | modules/websocket/websocket_peer.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/websocket/websocket_peer.cpp b/modules/websocket/websocket_peer.cpp index 91fdb2470a..724c73816f 100644 --- a/modules/websocket/websocket_peer.cpp +++ b/modules/websocket/websocket_peer.cpp @@ -72,6 +72,9 @@ void WebSocketPeer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_queued_packets", "buffer_size"), &WebSocketPeer::set_max_queued_packets); ClassDB::bind_method(D_METHOD("get_max_queued_packets"), &WebSocketPeer::get_max_queued_packets); + ClassDB::bind_method(D_METHOD("set_heartbeat_interval", "interval"), &WebSocketPeer::set_heartbeat_interval); + ClassDB::bind_method(D_METHOD("get_heartbeat_interval"), &WebSocketPeer::get_heartbeat_interval); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "supported_protocols"), "set_supported_protocols", "get_supported_protocols"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_STRING_ARRAY, "handshake_headers"), "set_handshake_headers", "get_handshake_headers"); @@ -80,6 +83,8 @@ void WebSocketPeer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "max_queued_packets"), "set_max_queued_packets", "get_max_queued_packets"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "heartbeat_interval"), "set_heartbeat_interval", "get_heartbeat_interval"); + BIND_ENUM_CONSTANT(WRITE_MODE_TEXT); BIND_ENUM_CONSTANT(WRITE_MODE_BINARY); @@ -153,3 +158,12 @@ void WebSocketPeer::set_max_queued_packets(int p_max_queued_packets) { int WebSocketPeer::get_max_queued_packets() const { return max_queued_packets; } + +double WebSocketPeer::get_heartbeat_interval() const { + return heartbeat_interval_msec / 1000.0; +} + +void WebSocketPeer::set_heartbeat_interval(double p_interval) { + ERR_FAIL_COND(p_interval < 0); + heartbeat_interval_msec = p_interval * 1000.0; +} |